Re: [PATCH spi for-5.4 14/14] spi: spi-fsl-dspi: Remove impossible to reach error check

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

 



On Sun, Aug 18, 2019 at 09:01:15PM +0300, Vladimir Oltean wrote:

> dspi->devtype_data is under the total control of the driver. Therefore,
> a bad value is a driver bug and checking it at runtime (and during an
> ISR, at that!) is pointless.

> -	trans_mode = dspi->devtype_data->trans_mode;
> -	switch (trans_mode) {
> -	case DSPI_EOQ_MODE:
> +	if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE)
>  		dspi_eoq_read(dspi);
> -		break;
> -	case DSPI_TCFQ_MODE:

The other reason for doing a switch statement is that it makes it easier
to add new condidions if more modes are added for some reason, the error
check is a nice side effect for robustness since it'll detect memory
corruption or other bugs but it's not the only reason to use this idiom.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux