Skip to content

Commit 79c5623

Browse files
storulffelipebalbi
authored andcommitted
usb: musb: ux500: Fix NULL pointer dereference at system PM
The commit 7d32cde ("usb: musb: fail with error when no DMA controller set"), caused the core platform driver to correctly return an error code when fail probing. Unfurtante it also caused bug for a NULL pointer dereference, during system suspend for the ux500 driver. The reason is a lacking validation of the corresponding ->driver_data pointer, which won't be set when the musb core driver fails to probe (or haven't yet been probed). Fixes: 7d32cde ("usb: musb: fail with error when no DMA...") Acked-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 63b121e commit 79c5623

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/usb/musb/ux500.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ static int ux500_suspend(struct device *dev)
348348
struct ux500_glue *glue = dev_get_drvdata(dev);
349349
struct musb *musb = glue_to_musb(glue);
350350

351-
usb_phy_set_suspend(musb->xceiv, 1);
351+
if (musb)
352+
usb_phy_set_suspend(musb->xceiv, 1);
353+
352354
clk_disable_unprepare(glue->clk);
353355

354356
return 0;
@@ -366,7 +368,8 @@ static int ux500_resume(struct device *dev)
366368
return ret;
367369
}
368370

369-
usb_phy_set_suspend(musb->xceiv, 0);
371+
if (musb)
372+
usb_phy_set_suspend(musb->xceiv, 0);
370373

371374
return 0;
372375
}

0 commit comments

Comments
 (0)