Commit e98b44e9 authored by Lothar Waßmann's avatar Lothar Waßmann Committed by Greg Kroah-Hartman

usb: chipidea: prevent endless loop registering platform_devices when probe fails

Commit 40dcd0e8 ("usb: chipidea: add PTW, PTS and STS handling") introduced
the following code to the ci_hdrc_probe() function:

+       if (!dev->of_node && dev->parent)
+               dev->of_node = dev->parent->of_node;

This inadvertently associates the ci_hdrc device with the ci_hdrc_imx
driver (which created the ci_hdrc device in the first place).

This results in ci_hdrc_imx_probe() being run for the ci_hdrc device
if ci_hdrc_probe() fails for some reason.
ci_hdrc_imx_probe() will happily create a new ci_hdrc platform_device
whose probing will likewise fail and trigger a new invocation of
ci_hdrc_imx_probe() ... ad nauseam.
Signed-off-by: default avatarLothar Waßmann <LW@KARO-electronics.de>
Reviewed-and-tested-by: default avatarPeter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3b1280ca
...@@ -404,15 +404,13 @@ static int ci_hdrc_probe(struct platform_device *pdev) ...@@ -404,15 +404,13 @@ static int ci_hdrc_probe(struct platform_device *pdev)
void __iomem *base; void __iomem *base;
int ret; int ret;
enum usb_dr_mode dr_mode; enum usb_dr_mode dr_mode;
struct device_node *of_node = dev->of_node ?: dev->parent->of_node;
if (!dev->platform_data) { if (!dev->platform_data) {
dev_err(dev, "platform data missing\n"); dev_err(dev, "platform data missing\n");
return -ENODEV; return -ENODEV;
} }
if (!dev->of_node && dev->parent)
dev->of_node = dev->parent->of_node;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res); base = devm_ioremap_resource(dev, res);
if (IS_ERR(base)) if (IS_ERR(base))
...@@ -453,12 +451,12 @@ static int ci_hdrc_probe(struct platform_device *pdev) ...@@ -453,12 +451,12 @@ static int ci_hdrc_probe(struct platform_device *pdev)
} }
if (!ci->platdata->phy_mode) if (!ci->platdata->phy_mode)
ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); ci->platdata->phy_mode = of_usb_get_phy_mode(of_node);
hw_phymode_configure(ci); hw_phymode_configure(ci);
if (!ci->platdata->dr_mode) if (!ci->platdata->dr_mode)
ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node); ci->platdata->dr_mode = of_usb_get_dr_mode(of_node);
if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN) if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN)
ci->platdata->dr_mode = USB_DR_MODE_OTG; ci->platdata->dr_mode = USB_DR_MODE_OTG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment