usb: dwc3: st: add missing depopulate in probe error path
commit cd4897bfd14f6a5388b21ba45a066541a0425199 upstream. Depopulate device in probe error paths to fix leak of children resources. Fixes: f83fca0707c6 ("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>
This commit is contained in:
parent
16cd1f0b0f
commit
7225b114e9
1 changed files with 4 additions and 1 deletions
|
@ -266,7 +266,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
|
||||||
if (!child_pdev) {
|
if (!child_pdev) {
|
||||||
dev_err(dev, "failed to find dwc3 core device\n");
|
dev_err(dev, "failed to find dwc3 core device\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto err_node_put;
|
goto depopulate;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev);
|
dwc3_data->dr_mode = usb_get_dr_mode(&child_pdev->dev);
|
||||||
|
@ -282,6 +282,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
|
||||||
ret = st_dwc3_drd_init(dwc3_data);
|
ret = st_dwc3_drd_init(dwc3_data);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "drd initialisation failed\n");
|
dev_err(dev, "drd initialisation failed\n");
|
||||||
|
of_platform_depopulate(dev);
|
||||||
goto undo_softreset;
|
goto undo_softreset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,6 +292,8 @@ static int st_dwc3_probe(struct platform_device *pdev)
|
||||||
platform_set_drvdata(pdev, dwc3_data);
|
platform_set_drvdata(pdev, dwc3_data);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
depopulate:
|
||||||
|
of_platform_depopulate(dev);
|
||||||
err_node_put:
|
err_node_put:
|
||||||
of_node_put(child);
|
of_node_put(child);
|
||||||
undo_softreset:
|
undo_softreset:
|
||||||
|
|
Loading…
Add table
Reference in a new issue