[PATCH 1/3] usb: musb-new: Null check before dereference
Andrew Goodbody
andrew.goodbody at linaro.org
Tue Sep 30 17:52:22 CEST 2025
A null check for the variable 'data' was introduced before dereferencing
it for set_phy_power but other uses were not so protected. Add the null
check for other dereferences of 'data'.
This issue was found by Smatch.
Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
drivers/usb/musb-new/am35x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c
index 42bc816e4f1e5ca0e6fa891c563fea65106e0b43..ca4d798642e731755473063df9507185b1d59205 100644
--- a/drivers/usb/musb-new/am35x.c
+++ b/drivers/usb/musb-new/am35x.c
@@ -402,7 +402,7 @@ static int am35x_musb_init(struct musb *musb)
#endif
/* Reset the musb */
- if (data->reset)
+ if (data && data->reset)
data->reset(data->dev);
/* Reset the controller */
@@ -417,7 +417,7 @@ static int am35x_musb_init(struct musb *musb)
musb->isr = am35x_musb_interrupt;
/* clear level interrupt */
- if (data->clear_irq)
+ if (data && data->clear_irq)
data->clear_irq(data->dev);
return 0;
--
2.47.3
More information about the U-Boot
mailing list