Thread (15 messages) 15 messages, 3 authors, 2021-10-08

Re: [PATCH 3/6] usb: chipidea: Check usb_phy exists before using it

From: Peter Chen <peter.chen@kernel.org>
Date: 2021-10-07 04:54:35
Also in: lkml

On 21-08-24 22:46:15, Manish Narani wrote:
usb_phy and usb_phy->set_vbus may not be present all the times
based on PHY driver used. So check for it.
Please squash this one with the first one.

Peter
quoted hunk ↗ jump to hunk
Signed-off-by: Subbaraya Sundeep Bhatta <redacted>
Signed-off-by: Michal Simek <redacted>
Signed-off-by: Manish Narani <redacted>
---
 drivers/usb/chipidea/otg_fsm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 2f7f94d..5f8f5d2 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -472,7 +472,8 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
 			}
 		}
 
-		if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL)
+		if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
+		    ci->usb_phy && ci->usb_phy->set_vbus)
 			ci->usb_phy->set_vbus(ci->usb_phy, 1);
 
 		/* Disable data pulse irq */
@@ -484,7 +485,8 @@ static void ci_otg_drv_vbus(struct otg_fsm *fsm, int on)
 		if (ci->platdata->reg_vbus)
 			regulator_disable(ci->platdata->reg_vbus);
 
-		if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL)
+		if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&
+		    ci->usb_phy && ci->usb_phy->set_vbus)
 			ci->usb_phy->set_vbus(ci->usb_phy, 0);
 
 		fsm->a_bus_drop = 1;
-- 
2.1.1
-- 

Thanks,
Peter Chen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help