All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-xiic: Fix the type check for xiic_wakeup
@ 2022-05-26  4:09 Shubhrajyoti Datta
  2022-05-31 11:03 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Shubhrajyoti Datta @ 2022-05-26  4:09 UTC (permalink / raw)
  To: linux-i2c; +Cc: michal.simek, Shubhrajyoti Datta

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

Enum is passed to xiic_wakeup, change the function parameter
to reflect it.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---

 drivers/i2c/busses/i2c-xiic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 9a1c3f8b7048..2b6341f08d71 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -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;
-- 
2.25.1


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

* Re: [PATCH] i2c-xiic: Fix the type check for xiic_wakeup
  2022-05-26  4:09 [PATCH] i2c-xiic: Fix the type check for xiic_wakeup Shubhrajyoti Datta
@ 2022-05-31 11:03 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2022-05-31 11:03 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-i2c; +Cc: michal.simek



On 5/26/22 06:09, Shubhrajyoti Datta wrote:
> Fix the coverity warning
> mixed_enum_type: enumerated type mixed with another type
> 
> Enum is passed to xiic_wakeup, change the function parameter
> to reflect it.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
> 
>   drivers/i2c/busses/i2c-xiic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 9a1c3f8b7048..2b6341f08d71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -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;


Change itself is fine but

wakeup_code in xiic_process should be also fixed because it is defined as int 
now and you are using initial value as 0.

It means your change and this one too.

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index ffefe3c482e9..b369b42fffd7 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 {
@@ -380,7 +380,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;

         /* Get the interrupt Status from the IPIF. There is no clearing of
          * interrupts in the IPIF. Interrupts must be cleared at the source.

M

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

end of thread, other threads:[~2022-05-31 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26  4:09 [PATCH] i2c-xiic: Fix the type check for xiic_wakeup Shubhrajyoti Datta
2022-05-31 11:03 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.