Skip to content

Commit

Permalink
usb: dwc3: st: add missing depopulate in probe error path
Browse files Browse the repository at this point in the history
commit cd4897b upstream.

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: [email protected]
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Patrice Chotard <[email protected]>
Acked-by: Thinh Nguyen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
krzk authored and gregkh committed Sep 4, 2024
1 parent f349865 commit b1069a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/usb/dwc3/dwc3-st.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ static int st_dwc3_probe(struct platform_device *pdev)
if (!child_pdev) {
dev_err(dev, "failed to find dwc3 core device\n");
ret = -ENODEV;
goto err_node_put;
goto depopulate;
}

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

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

depopulate:
of_platform_depopulate(dev);
err_node_put:
of_node_put(child);
undo_softreset:
Expand Down

0 comments on commit b1069a3

Please sign in to comment.