From 49d432dded021a2c87644beb95734e11602594a3 Mon Sep 17 00:00:00 2001 From: Dharageswari R Date: Wed, 12 Aug 2020 18:18:17 -0700 Subject: [PATCH] sof-ctl: Add support for read-only, write-only and read-write kcontrol This patch checks for the access type of kcontrol and returns error only when the access type is not read or write. Signed-off-by: Dharageswari R --- tools/ctl/ctl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tools/ctl/ctl.c b/tools/ctl/ctl.c index 957003397..b238afce0 100644 --- a/tools/ctl/ctl.c +++ b/tools/ctl/ctl.c @@ -355,12 +355,9 @@ static int ctl_setup(struct ctl_data *ctl_data) read = snd_ctl_elem_info_is_tlv_readable(ctl_data->info); write = snd_ctl_elem_info_is_tlv_writable(ctl_data->info); type = snd_ctl_elem_info_get_type(ctl_data->info); - if (!read) { - fprintf(stderr, "Error: No read capability.\n"); - goto value_free; - } - if (!write) { - fprintf(stderr, "Error: No write capability.\n"); + + if (!read && !write) { + fprintf(stderr, "Error: Not a read/write control\n"); goto value_free; } if (type != SND_CTL_ELEM_TYPE_BYTES) {