Skip to content

Commit

Permalink
spi: spi-fsl-dspi: Remove impossible to reach error check
Browse files Browse the repository at this point in the history
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.

The second "else if" check is only for clarity (instead of a broader
"else") in case other transfer modes are added in the future. But the
printing is dead code and can be removed.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://lore.kernel.org/r/20190822211514.19288-4-olteanv@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Vladimir Oltean authored and Mark Brown committed Aug 23, 2019
1 parent 37b4100 commit 1eaeba7
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions drivers/spi/spi-fsl-dspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,37 +670,21 @@ static irqreturn_t dspi_interrupt(int irq, void *dev_id)
msg->actual_length += spi_tcnt * dspi->bytes_per_word;

trans_mode = dspi->devtype_data->trans_mode;
switch (trans_mode) {
case DSPI_EOQ_MODE:
if (trans_mode == DSPI_EOQ_MODE)
dspi_eoq_read(dspi);
break;
case DSPI_TCFQ_MODE:
else if (trans_mode == DSPI_TCFQ_MODE)
dspi_tcfq_read(dspi);
break;
default:
dev_err(&dspi->pdev->dev, "unsupported trans_mode %u\n",
trans_mode);
return IRQ_HANDLED;
}

if (!dspi->len) {
dspi->waitflags = 1;
wake_up_interruptible(&dspi->waitq);
return IRQ_HANDLED;
}

switch (trans_mode) {
case DSPI_EOQ_MODE:
if (trans_mode == DSPI_EOQ_MODE)
dspi_eoq_write(dspi);
break;
case DSPI_TCFQ_MODE:
else if (trans_mode == DSPI_TCFQ_MODE)
dspi_tcfq_write(dspi);
break;
default:
dev_err(&dspi->pdev->dev,
"unsupported trans_mode %u\n",
trans_mode);
}

return IRQ_HANDLED;
}
Expand Down

0 comments on commit 1eaeba7

Please sign in to comment.