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