]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
usb: musb-new: Null check before dereference
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 30 Sep 2025 15:52:22 +0000 (16:52 +0100)
committerMarek Vasut <marek.vasut+usb@mailbox.org>
Tue, 28 Oct 2025 15:35:05 +0000 (16:35 +0100)
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@linaro.org>
drivers/usb/musb-new/am35x.c

index 42bc816e4f1e5ca0e6fa891c563fea65106e0b43..ca4d798642e731755473063df9507185b1d59205 100644 (file)
@@ -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;