[alsa-devel] [PATCH] ASoC: Fix to avoid compile error

Mark Brown broonie at opensource.wolfsonmicro.com
Mon Apr 4 06:55:56 CEST 2011


On Mon, Apr 04, 2011 at 01:15:04PM +0900, Seungwhan Youn wrote:

>  	case SND_SOC_I2C:
> +#if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE))
>  		ret = i2c_master_send(codec->control_data, data, len);
> +#endif
>  		break;
>  	case SND_SOC_SPI:
> +#if defined(CONFIG_SPI_MASTER)
>  		ret = do_spi_write(codec->control_data, data, len);
> +#endif
>  		break;

If we're going to ifdef these out we should be ifdefing out the entire
case, not just the operations.  Otherwise if we do manage to end up with
a broken configuration then the code will silently report success which
is broken - the fact that you have to initialise ret is a bad sign.


More information about the Alsa-devel mailing list