linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c-xiic: Fix the type check for xiic_wakeup
@ 2022-06-13  4:30 Shubhrajyoti Datta
  2022-06-13 14:54 ` Wolfram Sang
  0 siblings, 1 reply; 9+ messages in thread
From: Shubhrajyoti Datta @ 2022-06-13  4:30 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Shubhrajyoti Datta

Fix the coverity warning
mixed_enum_type: enumerated type mixed with another type

We are passing an enum in the xiic_wakeup lets change
the function parameters to reflect that.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
v2:
Update the wakeup_code to enum

 drivers/i2c/busses/i2c-xiic.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 9a1c3f8b7048..ec56b80653d3 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -34,9 +34,9 @@
 #define DRIVER_NAME "xiic-i2c"
 
 enum xilinx_i2c_state {
-	STATE_DONE,
-	STATE_ERROR,
-	STATE_START
+	STATE_DONE = 0,
+	STATE_ERROR = 1,
+	STATE_START = 2
 };
 
 enum xiic_endian {
@@ -367,7 +367,7 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c)
 	}
 }
 
-static void xiic_wakeup(struct xiic_i2c *i2c, int code)
+static void xiic_wakeup(struct xiic_i2c *i2c, enum xilinx_i2c_state code)
 {
 	i2c->tx_msg = NULL;
 	i2c->rx_msg = NULL;
@@ -383,7 +383,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 	u32 clr = 0;
 	int xfer_more = 0;
 	int wakeup_req = 0;
-	int wakeup_code = 0;
+	enum xilinx_i2c_state wakeup_code = STATE_DONE;
 	int ret;
 
 	/* Get the interrupt Status from the IPIF. There is no clearing of
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH v2] i2c-xiic: Fix the type check for xiic_wakeup
@ 2022-06-09 15:37 Shubhrajyoti Datta
  2022-06-09 15:55 ` Michal Simek
  0 siblings, 1 reply; 9+ messages in thread
From: Shubhrajyoti Datta @ 2022-06-09 15:37 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, git, Shubhrajyoti Datta

Fix the coverity warning
mixed_enum_type: enumerated type mixed with another type

We are passing an enum in the xiic_wakeup lets change
the function parameters to reflect that.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
v2:
Update the wakeup_code to enum

 drivers/i2c/busses/i2c-xiic.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 9a1c3f8b7048..ec56b80653d3 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -34,9 +34,9 @@
 #define DRIVER_NAME "xiic-i2c"
 
 enum xilinx_i2c_state {
-	STATE_DONE,
-	STATE_ERROR,
-	STATE_START
+	STATE_DONE = 0,
+	STATE_ERROR = 1,
+	STATE_START = 2
 };
 
 enum xiic_endian {
@@ -367,7 +367,7 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c)
 	}
 }
 
-static void xiic_wakeup(struct xiic_i2c *i2c, int code)
+static void xiic_wakeup(struct xiic_i2c *i2c, enum xilinx_i2c_state code)
 {
 	i2c->tx_msg = NULL;
 	i2c->rx_msg = NULL;
@@ -383,7 +383,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
 	u32 clr = 0;
 	int xfer_more = 0;
 	int wakeup_req = 0;
-	int wakeup_code = 0;
+	enum xilinx_i2c_state wakeup_code = STATE_DONE;
 	int ret;
 
 	/* Get the interrupt Status from the IPIF. There is no clearing of
-- 
2.17.1


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

end of thread, other threads:[~2022-06-14  9:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-13  4:30 [PATCH v2] i2c-xiic: Fix the type check for xiic_wakeup Shubhrajyoti Datta
2022-06-13 14:54 ` Wolfram Sang
2022-06-14  6:30   ` Shubhrajyoti Datta
2022-06-14  7:01   ` Michal Simek
2022-06-14  8:11     ` Wolfram Sang
2022-06-14  8:18       ` Greg Kroah-Hartman
2022-06-14  9:01       ` Michal Simek
  -- strict thread matches above, loose matches on Subject: below --
2022-06-09 15:37 Shubhrajyoti Datta
2022-06-09 15:55 ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).