* [PATCH] i3c: master: Initialize ret in i3c_i2c_notifier_call()
@ 2025-06-22 10:11 Jorge Marques
2025-06-24 19:04 ` Frank Li
2025-07-03 23:24 ` Alexandre Belloni
0 siblings, 2 replies; 3+ messages in thread
From: Jorge Marques @ 2025-06-22 10:11 UTC (permalink / raw)
To: Alexandre Belloni, Frank Li; +Cc: linux-i3c, linux-kernel, Jorge Marques
Set ret to -EINVAL if i3c_i2c_notifier_call() receives an invalid
action, resolving uninitialized warning.
Signed-off-by: Jorge Marques <jorge.marques@analog.com>
---
If a invalid action was passed to i3c_i2c_notifier_call(), uninitialized
would be returned. Add a default option in the switch case to set it as
-EINVAL; I didn't set at the variable definition for readability
purpose. The warning was caught by smatch.
---
drivers/i3c/master.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index fd81871609d95bc082bd401681e7e132ea74f8a7..68b8ea9174b984a6c89b389c4b3a9669239def70 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -2467,6 +2467,8 @@ static int i3c_i2c_notifier_call(struct notifier_block *nb, unsigned long action
case BUS_NOTIFY_DEL_DEVICE:
ret = i3c_master_i2c_detach(adap, client);
break;
+ default:
+ ret = -EINVAL;
}
i3c_bus_maintenance_unlock(&master->bus);
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250622-i3c-master-ret-uninitialized-16265d8a8719
Best regards,
--
Jorge Marques <jorge.marques@analog.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i3c: master: Initialize ret in i3c_i2c_notifier_call()
2025-06-22 10:11 [PATCH] i3c: master: Initialize ret in i3c_i2c_notifier_call() Jorge Marques
@ 2025-06-24 19:04 ` Frank Li
2025-07-03 23:24 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Frank Li @ 2025-06-24 19:04 UTC (permalink / raw)
To: Jorge Marques; +Cc: Alexandre Belloni, linux-i3c, linux-kernel
On Sun, Jun 22, 2025 at 12:11:07PM +0200, Jorge Marques wrote:
> Set ret to -EINVAL if i3c_i2c_notifier_call() receives an invalid
> action, resolving uninitialized warning.
>
> Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> If a invalid action was passed to i3c_i2c_notifier_call(), uninitialized
> would be returned. Add a default option in the switch case to set it as
> -EINVAL; I didn't set at the variable definition for readability
> purpose. The warning was caught by smatch.
> ---
> drivers/i3c/master.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index fd81871609d95bc082bd401681e7e132ea74f8a7..68b8ea9174b984a6c89b389c4b3a9669239def70 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -2467,6 +2467,8 @@ static int i3c_i2c_notifier_call(struct notifier_block *nb, unsigned long action
> case BUS_NOTIFY_DEL_DEVICE:
> ret = i3c_master_i2c_detach(adap, client);
> break;
> + default:
> + ret = -EINVAL;
> }
> i3c_bus_maintenance_unlock(&master->bus);
>
>
> ---
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> change-id: 20250622-i3c-master-ret-uninitialized-16265d8a8719
>
> Best regards,
> --
> Jorge Marques <jorge.marques@analog.com>
>
>
>
> --
> linux-i3c mailing list
> linux-i3c@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-i3c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i3c: master: Initialize ret in i3c_i2c_notifier_call()
2025-06-22 10:11 [PATCH] i3c: master: Initialize ret in i3c_i2c_notifier_call() Jorge Marques
2025-06-24 19:04 ` Frank Li
@ 2025-07-03 23:24 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2025-07-03 23:24 UTC (permalink / raw)
To: Frank Li, Jorge Marques; +Cc: linux-i3c, linux-kernel
On Sun, 22 Jun 2025 12:11:07 +0200, Jorge Marques wrote:
> Set ret to -EINVAL if i3c_i2c_notifier_call() receives an invalid
> action, resolving uninitialized warning.
>
>
Applied, thanks!
[1/1] i3c: master: Initialize ret in i3c_i2c_notifier_call()
https://git.kernel.org/abelloni/c/290ce8b2d074
Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-03 23:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-22 10:11 [PATCH] i3c: master: Initialize ret in i3c_i2c_notifier_call() Jorge Marques
2025-06-24 19:04 ` Frank Li
2025-07-03 23:24 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®