summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc_otg_310/dwc_otg_driver.c
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-06-14 14:39:02 +0200
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2019-09-27 20:57:23 +0200
commitd56fb5f89b1501dd7922c1c6d3c97f963df7a4af (patch)
tree743bbe5dc197278b9bc8161bf5bb1e6d9e5da52e /drivers/usb/dwc_otg_310/dwc_otg_driver.c
parent6903a6d6c2ee1a591be70ffd8b8b582d9d4e3473 (diff)
usb: dwc_otg_310: Prevent phy access if not probed.
In case the PHY is not successfully probed, we cannot access PHY functions like usb20otg_hw_init(), because they assume successful probing and might dereference NULL pointers otherwise. This patch addresses this by introducing a flag 'is_probed', which can be checked during controller probing time to verify, that the PHY has been probed. If this was not the case, controller probing will be deferred. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Diffstat (limited to 'drivers/usb/dwc_otg_310/dwc_otg_driver.c')
-rw-r--r--drivers/usb/dwc_otg_310/dwc_otg_driver.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/dwc_otg_310/dwc_otg_driver.c b/drivers/usb/dwc_otg_310/dwc_otg_driver.c
index 7bcf93dbe905..e903bb30f367 100644
--- a/drivers/usb/dwc_otg_310/dwc_otg_driver.c
+++ b/drivers/usb/dwc_otg_310/dwc_otg_driver.c
@@ -992,6 +992,12 @@ static int host20_driver_probe(struct platform_device *_dev)
return -EINVAL;
}
+ if (pldata->is_probed) {
+ if (pldata->is_probed() == 0) {
+ return -EPROBE_DEFER;
+ }
+ }
+
if (pldata->hw_init)
pldata->hw_init();
@@ -1381,6 +1387,12 @@ static int otg20_driver_probe(struct platform_device *_dev)
return -EINVAL;
}
+ if (pldata->is_probed) {
+ if (pldata->is_probed() == 0) {
+ return -EPROBE_DEFER;
+ }
+ }
+
if (pldata->hw_init)
pldata->hw_init();