[alsa-devel] [PATCH 2/2] ASoC: rt5645: Fix potential crash in jd function

Mark Brown broonie at kernel.org
Tue Nov 25 13:11:21 CET 2014


On Tue, Nov 18, 2014 at 04:50:19PM +0800, Bard Liao wrote:

> @@ -2209,6 +2209,10 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec)
>  	int gpio_state, jack_type = 0;
>  	unsigned int val;
>  
> +	if (!gpio_is_valid(rt5645->pdata.hp_det_gpio)) {
> +		dev_err(codec->dev, "invalid gpio\n");
> +		return 0;
> +	}

It's not obvious that we should be returning 0 here - shouldn't we be
returning an error?  After all an error message is being displayed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20141125/0e35f23d/attachment-0001.sig>


More information about the Alsa-devel mailing list