* [PATCH] i2c: xiic: Correct return value check for xiic_reinit()
@ 2023-09-20 13:41 Daniel Scally
2023-09-21 12:13 ` Michal Simek
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Scally @ 2023-09-20 13:41 UTC (permalink / raw)
To: Michal Simek, Andi Shyti, Wolfram Sang, Shubhrajyoti Datta,
linux-arm-kernel, linux-i2c
Cc: Raviteja Narayanam, Daniel Scally
The error paths for xiic_reinit() return negative values on failure
and 0 on success - this error message therefore is triggered on
_success_ rather than failure. Correct the condition so it's only
shown on failure as intended.
Fixes: 8fa9c9388053 ("i2c: xiic: return value of xiic_reinit")
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.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 b3bb97762c85..71391b590ada 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -710,7 +710,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
* reset the IP instead of just flush fifos
*/
ret = xiic_reinit(i2c);
- if (!ret)
+ if (ret < 0)
dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
if (i2c->rx_msg) {
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: xiic: Correct return value check for xiic_reinit()
2023-09-20 13:41 [PATCH] i2c: xiic: Correct return value check for xiic_reinit() Daniel Scally
@ 2023-09-21 12:13 ` Michal Simek
2023-09-21 21:30 ` Andi Shyti
2023-09-22 10:07 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2023-09-21 12:13 UTC (permalink / raw)
To: Daniel Scally, Andi Shyti, Wolfram Sang, Shubhrajyoti Datta,
linux-arm-kernel, linux-i2c
Cc: Raviteja Narayanam
On 9/20/23 15:41, Daniel Scally wrote:
> The error paths for xiic_reinit() return negative values on failure
> and 0 on success - this error message therefore is triggered on
> _success_ rather than failure. Correct the condition so it's only
> shown on failure as intended.
>
> Fixes: 8fa9c9388053 ("i2c: xiic: return value of xiic_reinit")
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.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 b3bb97762c85..71391b590ada 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -710,7 +710,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
> * reset the IP instead of just flush fifos
> */
> ret = xiic_reinit(i2c);
> - if (!ret)
> + if (ret < 0)
> dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
>
> if (i2c->rx_msg) {
It would be interesting to know how origin patch was tested.
Anyway
Acked-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: xiic: Correct return value check for xiic_reinit()
2023-09-20 13:41 [PATCH] i2c: xiic: Correct return value check for xiic_reinit() Daniel Scally
2023-09-21 12:13 ` Michal Simek
@ 2023-09-21 21:30 ` Andi Shyti
2023-09-22 10:07 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Andi Shyti @ 2023-09-21 21:30 UTC (permalink / raw)
To: Daniel Scally
Cc: Michal Simek, Wolfram Sang, Shubhrajyoti Datta, linux-arm-kernel,
linux-i2c, Raviteja Narayanam
Hi Daniel,
[...]
> @@ -710,7 +710,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id)
> * reset the IP instead of just flush fifos
> */
> ret = xiic_reinit(i2c);
> - if (!ret)
> + if (ret < 0)
> dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
this should be a dev_warn(), but it's anyway out of the scope of
this patch.
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Andi
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: xiic: Correct return value check for xiic_reinit()
2023-09-20 13:41 [PATCH] i2c: xiic: Correct return value check for xiic_reinit() Daniel Scally
2023-09-21 12:13 ` Michal Simek
2023-09-21 21:30 ` Andi Shyti
@ 2023-09-22 10:07 ` Wolfram Sang
2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2023-09-22 10:07 UTC (permalink / raw)
To: Daniel Scally
Cc: Michal Simek, Andi Shyti, Shubhrajyoti Datta, linux-arm-kernel,
linux-i2c, Raviteja Narayanam
[-- Attachment #1.1: Type: text/plain, Size: 473 bytes --]
On Wed, Sep 20, 2023 at 02:41:09PM +0100, Daniel Scally wrote:
> The error paths for xiic_reinit() return negative values on failure
> and 0 on success - this error message therefore is triggered on
> _success_ rather than failure. Correct the condition so it's only
> shown on failure as intended.
>
> Fixes: 8fa9c9388053 ("i2c: xiic: return value of xiic_reinit")
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Applied to for-current, thanks!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-22 10:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-20 13:41 [PATCH] i2c: xiic: Correct return value check for xiic_reinit() Daniel Scally
2023-09-21 12:13 ` Michal Simek
2023-09-21 21:30 ` Andi Shyti
2023-09-22 10:07 ` Wolfram Sang
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).