[alsa-devel] [PATCH 1/2] ASoC: cs4341: Add driver for CS4341 CODEC

Mark Brown broonie at kernel.org
Sat Sep 24 21:07:16 CEST 2016


On Thu, Sep 08, 2016 at 07:29:29PM +0300, Alexander Shiyan wrote:

> +	switch (format & SND_SOC_DAIFMT_INV_MASK) {
> +	case SND_SOC_DAIFMT_NB_NF:
> +		break;
> +	default:
> +		goto fmt_err;
> +	}

Why the goto?  Just put the error handling code in here directly.

> +	switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
> +	case SND_SOC_DAIFMT_I2S:
> +	case SND_SOC_DAIFMT_LEFT_J:
> +	case SND_SOC_DAIFMT_RIGHT_J:
> +		cs4341->fmt = format & SND_SOC_DAIFMT_FORMAT_MASK;
> +		return 0;
> +	default:
> +		break;

We silently ignore invalid formats here...

> +	SOC_SINGLE("Popguard Transient Control", CS4341_REG_MODE2, 1, 1, 0),

Popguard Transient Switch so that userspace tools know how to handle
this.

> +	spi->bits_per_word = spi->bits_per_word ? : 8;
> +	spi->max_speed_hz = spi->max_speed_hz ? : 6000000;

Please write normal if statements, it's easier to read..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160924/7c9953c6/attachment.sig>


More information about the Alsa-devel mailing list