Skip to content

Commit 36fc1c1

Browse files
sessegregkh
authored andcommitted
usb: dwc3: exynos: Fix deferred probing storm.
commit 4879efb34f7d49235fac334d76d9c6a77a021413 upstream. dwc3-exynos has two problems during init if the regulators are slow to come up (for instance if the I2C bus driver is not on the initramfs) and return probe deferral. First, every time this happens, the driver leaks the USB phys created; they need to be deallocated on error. Second, since the phy devices are created before the regulators fail, this means that there's a new device to re-trigger deferred probing, which causes it to essentially go into a busy loop of re-probing the device until the regulators come up. Move the phy creation to after the regulators have succeeded, and also fix cleanup on failure. On my ODROID XU4 system (with Debian's initramfs which doesn't contain the I2C driver), this reduces the number of probe attempts (for each of the two controllers) from more than 2000 to eight. Signed-off-by: Steinar H. Gunderson <sesse@google.com> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Vivek Gautam <gautam.vivek@samsung.com> Fixes: d720f05 ("usb: dwc3: exynos: add nop transceiver support") Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 89c18f1 commit 36fc1c1

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

drivers/usb/dwc3/dwc3-exynos.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
128128

129129
platform_set_drvdata(pdev, exynos);
130130

131-
ret = dwc3_exynos_register_phys(exynos);
132-
if (ret) {
133-
dev_err(dev, "couldn't register PHYs\n");
134-
return ret;
135-
}
136-
137131
exynos->dev = dev;
138132

139133
exynos->clk = devm_clk_get(dev, "usbdrd30");
@@ -183,20 +177,29 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
183177
goto err3;
184178
}
185179

180+
ret = dwc3_exynos_register_phys(exynos);
181+
if (ret) {
182+
dev_err(dev, "couldn't register PHYs\n");
183+
goto err4;
184+
}
185+
186186
if (node) {
187187
ret = of_platform_populate(node, NULL, NULL, dev);
188188
if (ret) {
189189
dev_err(dev, "failed to add dwc3 core\n");
190-
goto err4;
190+
goto err5;
191191
}
192192
} else {
193193
dev_err(dev, "no device node, failed to add dwc3 core\n");
194194
ret = -ENODEV;
195-
goto err4;
195+
goto err5;
196196
}
197197

198198
return 0;
199199

200+
err5:
201+
platform_device_unregister(exynos->usb2_phy);
202+
platform_device_unregister(exynos->usb3_phy);
200203
err4:
201204
regulator_disable(exynos->vdd10);
202205
err3:

0 commit comments

Comments
 (0)