Skip to content

Commit cd4897b

Browse files
krzkgregkh
authored andcommitted
usb: dwc3: st: add missing depopulate in probe error path
Depopulate device in probe error paths to fix leak of children resources. Fixes: f83fca0 ("usb: dwc3: add ST dwc3 glue layer to manage dwc3 HC") Cc: stable@vger.kernel.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Link: https://lore.kernel.org/r/20240814093957.37940-2-krzysztof.kozlowski@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ddfcfeb commit cd4897b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/usb/dwc3/dwc3-st.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
266266
if (!child_pdev) {
267267
dev_err(dev, "failed to find dwc3 core device\n");
268268
ret = -ENODEV;
269-
goto err_node_put;
269+
goto depopulate;
270270
}
271271

272272
dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev);
@@ -282,6 +282,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
282282
ret = st_dwc3_drd_init(dwc3_data);
283283
if (ret) {
284284
dev_err(dev, "drd initialisation failed\n");
285+
of_platform_depopulate(dev);
285286
goto undo_softreset;
286287
}
287288

@@ -291,6 +292,8 @@ static int st_dwc3_probe(struct platform_device *pdev)
291292
platform_set_drvdata(pdev, dwc3_data);
292293
return 0;
293294

295+
depopulate:
296+
of_platform_depopulate(dev);
294297
err_node_put:
295298
of_node_put(child);
296299
undo_softreset:

0 commit comments

Comments
 (0)