[PATCH] ASoC: wm8350: Handle error for wm8350_register_irq

Charles Keepax ckeepax at opensource.cirrus.com
Thu Mar 3 14:38:34 CET 2022


On Thu, Mar 03, 2022 at 04:21:54PM +0800, Jiasheng Jiang wrote:
> As the potential failure of the wm8350_register_irq(),
> it should be better to check it and return error if fails.
> Also, use 'free_' in order to avoid the same code.
> 
> Fixes: a6ba2b2dabb5 ("ASoC: Implement WM8350 headphone jack detection")
> Signed-off-by: Jiasheng Jiang <jiasheng at iscas.ac.cn>
> ---
>  sound/soc/codecs/wm8350.c | 30 +++++++++++++++++++++++++-----
>  1 file changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
> index 15d42ce3b21d..0c70bbfbedb5 100644
> --- a/sound/soc/codecs/wm8350.c
> +++ b/sound/soc/codecs/wm8350.c
> @@ -1483,7 +1483,7 @@ static  int wm8350_component_probe(struct snd_soc_component *component)
>  	ret = devm_regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies),
>  				 priv->supplies);
>  	if (ret != 0)
> -		return ret;
> +		goto err;

I would probably just leave this as a return, nothing is gained
changing it to a goto.

>  
> +	ret = wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_JCK_DET_R,
>  			    wm8350_hpr_jack_handler, 0, "Right jack detect",
>  			    priv);
> -	wm8350_register_irq(wm8350, WM8350_IRQ_CODEC_MICSCD,
> +	if (ret != 0)
> +		goto free_JCK_DET_L;

Probably better to use non-caps here, having caps in a label is a
little unusual.

Otherwise I think this looks fine.

Thanks,
Charles


More information about the Alsa-devel mailing list