[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220512132511.40637-1-guozhengkui@vivo.com>
Date: Thu, 12 May 2022 21:25:11 +0800
From: Guo Zhengkui <guozhengkui@...o.com>
To: Guenter Roeck <linux@...ck-us.net>, Peter Rosin <peda@...ntia.se>,
linux-i2c@...r.kernel.org (open list:PCA9541 I2C BUS MASTER SELECTOR
DRIVER), linux-kernel@...r.kernel.org (open list)
Cc: zhengkui_guo@...look.com, Guo Zhengkui <guozhengkui@...o.com>
Subject: [PATCH] i2c: mux: pca9541: replace ternary operator with min()
Fix the following coccicheck warning:
drivers/i2c/muxes/i2c-mux-pca9541.c:263:14-15: 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@...o.com>
---
drivers/i2c/muxes/i2c-mux-pca9541.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c
index 6daec8d3d331..f374a1e85837 100644
--- a/drivers/i2c/muxes/i2c-mux-pca9541.c
+++ b/drivers/i2c/muxes/i2c-mux-pca9541.c
@@ -260,7 +260,7 @@ static int pca9541_select_chan(struct i2c_mux_core *muxc, u32 chan)
do {
ret = pca9541_arbitrate(client);
if (ret)
- return ret < 0 ? ret : 0;
+ return min(ret, 0);
if (data->select_timeout == SELECT_DELAY_SHORT)
udelay(data->select_timeout);
--
2.20.1
Powered by blists - more mailing lists