public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next] i2c: microchip: pci1xxxx: Fix comparison of -EPERM against an unsigned variable
@ 2022-10-04 19:27 Colin Ian King
  2022-10-05 18:53 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-10-04 19:27 UTC (permalink / raw)
  To: Tharun Kumar P, Kumaravel Thiagarajan,
	Microchip Linux Driver Support, Andy Shevchenko, Wolfram Sang,
	linux-i2c
  Cc: kernel-janitors, linux-kernel

The comparison of variable ret with -EPERM is always false because
ret is an u8 type. Fix this by making ret an int.

Cleans up clang warning:
drivers/i2c/busses/i2c-mchp-pci1xxxx.c:714:10: warning: result of comparison
of constant -1 with expression of type 'u8' (aka 'unsigned char') is always
false [-Wtautological-constant-out-of-range-compare]

Fixes: 361693697249 ("i2c: microchip: pci1xxxx: Add driver for I2C host controller in multifunction endpoint of pci1xxxx switch")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/i2c/busses/i2c-mchp-pci1xxxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
index f5342201eb6b..09af75921147 100644
--- a/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
+++ b/drivers/i2c/busses/i2c-mchp-pci1xxxx.c
@@ -708,7 +708,7 @@ static void pci1xxxx_i2c_init(struct pci1xxxx_i2c *i2c)
 	void __iomem *p2 = i2c->i2c_base + SMBUS_STATUS_REG_OFF;
 	void __iomem *p1 = i2c->i2c_base + SMB_GPR_REG;
 	u8 regval;
-	u8 ret;
+	int ret;
 
 	ret = set_sys_lock(i2c);
 	if (ret == -EPERM) {
-- 
2.37.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-05 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04 19:27 [PATCH][next] i2c: microchip: pci1xxxx: Fix comparison of -EPERM against an unsigned variable Colin Ian King
2022-10-05 18:53 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox