Skip to content

Commit b1849f5

Browse files
Guo Zhengkuibroonie
authored andcommitted
spi: spi-au1550: replace ternary operator with min()
Fix the following coccicheck warnings: drivers/spi/spi-au1550.c:408:21-22: WARNING opportunity for min() drivers/spi/spi-au1550.c:542:21-22: WARNING opportunity for min() min() macro is defined in include/linux/minmax.h. It avoids multiple evaluations of the arguments when non-constant and performs strict type-checking. Signed-off-by: Guo Zhengkui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 22d35e4 commit b1849f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/spi/spi-au1550.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t)
405405
dma_unmap_single(hw->dev, dma_tx_addr, t->len,
406406
DMA_TO_DEVICE);
407407

408-
return hw->rx_count < hw->tx_count ? hw->rx_count : hw->tx_count;
408+
return min(hw->rx_count, hw->tx_count);
409409
}
410410

411411
static irqreturn_t au1550_spi_dma_irq_callback(struct au1550_spi *hw)
@@ -539,7 +539,7 @@ static int au1550_spi_pio_txrxb(struct spi_device *spi, struct spi_transfer *t)
539539

540540
wait_for_completion(&hw->master_done);
541541

542-
return hw->rx_count < hw->tx_count ? hw->rx_count : hw->tx_count;
542+
return min(hw->rx_count, hw->tx_count);
543543
}
544544

545545
static irqreturn_t au1550_spi_pio_irq_callback(struct au1550_spi *hw)

0 commit comments

Comments
 (0)