[alsa-devel] [PATCH 2/2] ASoC: cs4270: add power management support

Timur Tabi timur at freescale.com
Tue May 5 17:30:48 CEST 2009


Daniel Mack wrote:

> +static int cs4270_i2c_suspend(struct i2c_client *client, pm_message_t mesg)
> +{
> +	struct cs4270_private *cs4270 = i2c_get_clientdata(client);
> +	struct snd_soc_codec *codec = &cs4270->codec;
> +	int reg = snd_soc_read(codec, CS4270_PWRCTL);
> +
> +	if (reg < 0)
> +		return reg;

You check for an error code from snd_soc_read() here, but ...

> +	/* ... then disable the power-down bits */
> +	reg = snd_soc_read(codec, CS4270_PWRCTL);

you don't check for it here.

In cs4270_i2c_suspend(), snd_soc_read() can never return an error,
because you're passing a hard-coded register address.

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the Alsa-devel mailing list