Re: [PATCH 1/2] ASoC: cs4341: Add driver for CS4341 CODEC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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..

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux