From: Peter Ujfalusi Date: Tue, 21 Mar 2023 14:56:51 +0000 (+0200) Subject: ASoC: SOF: ipc4-control: Return on error in sof_ipc4_widget_kcontrol_setup() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1c12e032cc43256d75fdd22e60a7df85e8df4549;p=linux.git ASoC: SOF: ipc4-control: Return on error in sof_ipc4_widget_kcontrol_setup() The patch adding the bytes control support moved the error check outside of the list_for_each_entry() which was not correct as at the end of the list_for_each_entry() the scontrol will no longer point where the error happened, but it to the list head. Restore the original logic and return on the first error with the error code. Fixes: a062c8899fed ("ASoC: SOF: ipc4-control: Add support for bytes control get and put") Reported-by: Dan Carpenter Link: https://lore.kernel.org/alsa-devel/6be945d2-40cb-46fb-67ba-ed3a19cddfa4@linux.intel.com/T/#t Signed-off-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20230321145651.9118-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/ipc4-control.c b/sound/soc/sof/ipc4-control.c index d26ed2a6029f8..6f0698be9451f 100644 --- a/sound/soc/sof/ipc4-control.c +++ b/sound/soc/sof/ipc4-control.c @@ -429,14 +429,17 @@ static int sof_ipc4_widget_kcontrol_setup(struct snd_sof_dev *sdev, struct snd_s default: break; } + + if (ret < 0) { + dev_err(sdev->dev, + "kcontrol %d set up failed for widget %s\n", + scontrol->comp_id, swidget->widget->name); + return ret; + } } } - if (ret < 0) - dev_err(sdev->dev, "kcontrol %d set up failed for widget %s\n", - scontrol->comp_id, swidget->widget->name); - - return ret; + return 0; } static int