diff options
author | Paul Cercueil <paul@crapouillou.net> | 2022-10-26 19:26:53 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-09 12:39:13 +0100 |
commit | a6d45ea063f0a9272f62925c8150439af5640e74 (patch) | |
tree | a3bc834afb783a3df0ed7045b6876786131b15ee /drivers/usb/musb/musb_core.h | |
parent | 285f28bfed89a56ed619054f21125b0bd2f0d4d6 (diff) | |
download | linux-stable-a6d45ea063f0a9272f62925c8150439af5640e74.tar.gz linux-stable-a6d45ea063f0a9272f62925c8150439af5640e74.tar.bz2 linux-stable-a6d45ea063f0a9272f62925c8150439af5640e74.zip |
usb: musb: Allow running without CONFIG_USB_PHY
Modify the core so that musb->xceiv is never deferenced without being
checked first.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221026182657.146630-4-paul@crapouillou.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/musb/musb_core.h')
-rw-r--r-- | drivers/usb/musb/musb_core.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index a497c44ab0da..b7588d11cfc5 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -339,6 +339,8 @@ struct musb { struct usb_phy *xceiv; struct phy *phy; + enum usb_otg_state otg_state; + int nIrq; unsigned irq_wake:1; @@ -595,12 +597,18 @@ static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum) static inline void musb_set_state(struct musb *musb, enum usb_otg_state otg_state) { - musb->xceiv->otg->state = otg_state; + if (musb->xceiv) + musb->xceiv->otg->state = otg_state; + else + musb->otg_state = otg_state; } static inline enum usb_otg_state musb_get_state(struct musb *musb) { - return musb->xceiv->otg->state; + if (musb->xceiv) + return musb->xceiv->otg->state; + + return musb->otg_state; } static inline const char *musb_otg_state_string(struct musb *musb) |