[PATCH] Sound:mixer_scarlett2:Add error check after retrieving PEQ filter values

Zhu Jun posted 1 patch 1 month, 2 weeks ago
sound/usb/mixer_scarlett2.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] Sound:mixer_scarlett2:Add error check after retrieving PEQ filter values
Posted by Zhu Jun 1 month, 2 weeks ago
Add error check after retrieving PEQ filter values in scarlett2_update_filter_values
that ensure function returns error if PEQ filter value retrieval fails

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
 sound/usb/mixer_scarlett2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/usb/mixer_scarlett2.c b/sound/usb/mixer_scarlett2.c
index 1150cf104985..1b864a9621ba 100644
--- a/sound/usb/mixer_scarlett2.c
+++ b/sound/usb/mixer_scarlett2.c
@@ -5614,6 +5614,9 @@ static int scarlett2_update_filter_values(struct usb_mixer_interface *mixer)
 			SCARLETT2_BIQUAD_COEFFS,
 		peq_flt_values);
 
+	if (err < 0)
+		return err;
+
 	for (i = 0, dst_idx = 0; i < info->dsp_input_count; i++) {
 		src_idx = i *
 			  info->peq_flt_total_count *
-- 
2.17.1
Re: [PATCH] ALSA: scarlett2: Add error check after retrieving PEQ filter values
Posted by Markus Elfring 1 month, 2 weeks ago
Please check the subsystem specification once more.


> Add error check after retrieving PEQ filter values in scarlett2_update_filter_values
> that ensure function returns error if PEQ filter value retrieval fails

* It is usually preferred to end a sentence with a dot, isn't it?

* Would you like to add any tags (like “Fixes” and “Cc”) accordingly?


…
> +++ b/sound/usb/mixer_scarlett2.c
> @@ -5614,6 +5614,9 @@ static int scarlett2_update_filter_values(struct usb_mixer_interface *mixer)
>  			SCARLETT2_BIQUAD_COEFFS,
>  		peq_flt_values);
>
> +	if (err < 0)
> +		return err;
> +
>  	for (i = 0, dst_idx = 0; i < info->dsp_input_count; i++) {
…

I suggest to omit a blank line before the return value check.

Regards,
Markus