Skip to content

Commit

Permalink
usb: musb: da8xx: fix a resource leak in probe()
Browse files Browse the repository at this point in the history
commit de644a4 upstream.

Call usb_phy_generic_unregister() if of_platform_populate() fails.

Fixes: d6299b6 ("usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx")
Cc: stable <stable@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/69af1b1d-d3f4-492b-bcea-359ca5949f30@moroto.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Jul 5, 2024
1 parent e9835f3 commit 7afa50c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/usb/musb/da8xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static int da8xx_probe(struct platform_device *pdev)
ret = of_platform_populate(pdev->dev.of_node, NULL,
da8xx_auxdata_lookup, &pdev->dev);
if (ret)
return ret;
goto err_unregister_phy;

pinfo = da8xx_dev_info;
pinfo.parent = &pdev->dev;
Expand All @@ -568,9 +568,13 @@ static int da8xx_probe(struct platform_device *pdev)
ret = PTR_ERR_OR_ZERO(glue->musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
usb_phy_generic_unregister(glue->usb_phy);
goto err_unregister_phy;
}

return 0;

err_unregister_phy:
usb_phy_generic_unregister(glue->usb_phy);
return ret;
}

Expand Down

0 comments on commit 7afa50c

Please sign in to comment.