diff options
author | Guo Zhengkui <guozhengkui@vivo.com> | 2022-05-13 16:03:33 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-05-16 19:57:01 +0300 |
commit | b1849f505f87f11815d55e03b67e97aa87ea9b5d (patch) | |
tree | 7bf08d08d772f2622cdb3cb84704ea0a9e3fa153 /drivers/spi/spi-au1550.c | |
parent | 22d35e40419a2ac0914fb6b05c8781c9af8d4126 (diff) | |
download | linux-b1849f505f87f11815d55e03b67e97aa87ea9b5d.tar.xz |
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 <guozhengkui@vivo.com>
Link: https://lore.kernel.org/r/20220513130333.58379-1-guozhengkui@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-au1550.c')
-rw-r--r-- | drivers/spi/spi-au1550.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index 4b59a1b1bf7e..e008761298da 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c @@ -405,7 +405,7 @@ static int au1550_spi_dma_txrxb(struct spi_device *spi, struct spi_transfer *t) dma_unmap_single(hw->dev, dma_tx_addr, t->len, DMA_TO_DEVICE); - return hw->rx_count < hw->tx_count ? hw->rx_count : hw->tx_count; + return min(hw->rx_count, hw->tx_count); } 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) wait_for_completion(&hw->master_done); - return hw->rx_count < hw->tx_count ? hw->rx_count : hw->tx_count; + return min(hw->rx_count, hw->tx_count); } static irqreturn_t au1550_spi_pio_irq_callback(struct au1550_spi *hw) |