[alsa-devel] [PATCH 02/10] ASoC: sta32x: make sta32x a gpio consumer for the reset GPIO

Mark Brown broonie at kernel.org
Tue Jan 27 18:00:49 CET 2015


On Thu, Jan 22, 2015 at 12:01:54AM +0100, Thomas Niederprüm wrote:

> +	/* GPIOs */
> +	sta32x->gpiod_nreset = devm_gpiod_get(dev, "reset");
> +	if (IS_ERR(sta32x->gpiod_nreset)) {
> +		ret = PTR_ERR(sta32x->gpiod_nreset);
> +		if (ret != -ENOENT && ret != -ENOSYS)
> +			return ret;
> +
> +		sta32x->gpiod_nreset = NULL;

I'll apply this but in general this pattern of replacing error pointers
with NULL is a bit suspect - if the way you test for failure is IS_ERR()
then just carry on using IS_ERR() all through the code to check if you
got something valid, it's less likely for GPIOs but most other things
can substitute in dummies and NULL can be a good way of specifying a
dummy.
-------------- 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/20150127/95b2bf04/attachment.sig>


More information about the Alsa-devel mailing list