diff options
author | Lothar Waßmann <LW@KARO-electronics.de> | 2013-08-14 05:44:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-14 15:34:16 -0400 |
commit | e98b44e90b2e8c58c5cbd921b8509e1b7b4940d3 (patch) | |
tree | e94d9bc866f0f6107c9a09e8cbec57f6151a5a71 | |
parent | 3b1280ca4b1743de3be04e9dd5907ec79d72483d (diff) |
usb: chipidea: prevent endless loop registering platform_devices when probe fails
Commit 40dcd0e ("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: Lothar Waßmann <LW@KARO-electronics.de>
Reviewed-and-tested-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/chipidea/core.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 2400b7f87f97..075b419a3076 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -404,15 +404,13 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
404 | void __iomem *base; | 404 | void __iomem *base; |
405 | int ret; | 405 | int ret; |
406 | enum usb_dr_mode dr_mode; | 406 | enum usb_dr_mode dr_mode; |
407 | struct device_node *of_node = dev->of_node ?: dev->parent->of_node; | ||
407 | 408 | ||
408 | if (!dev->platform_data) { | 409 | if (!dev->platform_data) { |
409 | dev_err(dev, "platform data missing\n"); | 410 | dev_err(dev, "platform data missing\n"); |
410 | return -ENODEV; | 411 | return -ENODEV; |
411 | } | 412 | } |
412 | 413 | ||
413 | if (!dev->of_node && dev->parent) | ||
414 | dev->of_node = dev->parent->of_node; | ||
415 | |||
416 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 414 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
417 | base = devm_ioremap_resource(dev, res); | 415 | base = devm_ioremap_resource(dev, res); |
418 | if (IS_ERR(base)) | 416 | if (IS_ERR(base)) |
@@ -453,12 +451,12 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
453 | } | 451 | } |
454 | 452 | ||
455 | if (!ci->platdata->phy_mode) | 453 | if (!ci->platdata->phy_mode) |
456 | ci->platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); | 454 | ci->platdata->phy_mode = of_usb_get_phy_mode(of_node); |
457 | 455 | ||
458 | hw_phymode_configure(ci); | 456 | hw_phymode_configure(ci); |
459 | 457 | ||
460 | if (!ci->platdata->dr_mode) | 458 | if (!ci->platdata->dr_mode) |
461 | ci->platdata->dr_mode = of_usb_get_dr_mode(dev->of_node); | 459 | ci->platdata->dr_mode = of_usb_get_dr_mode(of_node); |
462 | 460 | ||
463 | if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN) | 461 | if (ci->platdata->dr_mode == USB_DR_MODE_UNKNOWN) |
464 | ci->platdata->dr_mode = USB_DR_MODE_OTG; | 462 | ci->platdata->dr_mode = USB_DR_MODE_OTG; |