[alsa-devel] [PATCH] ASoC: max98357a: release GPIO when component removing

Mark Brown broonie at kernel.org
Wed May 8 08:33:18 CEST 2019


On Tue, May 07, 2019 at 01:11:40PM +0800, Tzung-Bi Shih wrote:

> +static void max98357a_component_remove(struct snd_soc_component *component)
> +{
> +	struct max98357a_priv *max98357a =
> +			snd_soc_component_get_drvdata(component);
> +
> +	if (max98357a->sdmode)
> +		devm_gpiod_put(component->dev, max98357a->sdmode);
> +}

This is an obvious mess, if you're explicitly freeing devm_ allocated
resources in the common case something is going wrong.  Just move the
initial allocation to the device level probe so devm can do what it's
supposed to.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20190508/534bc5a9/attachment-0001.sig>


More information about the Alsa-devel mailing list