Skip to contentSkip to conversation

usb: musb: mpfs: Fix error codes in probe()

PATCH In review Dan Carpenter 2 participants 2 messages Jun 24, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: musb: mpfs: Fix error codes in probe()

These error paths return success but they need to return a negative error code.

Fixes 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
---
 drivers/usb/musb/mpfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/musb/mpfs.c +4 -1
index 99666ef8af06..a69ca338eace 100644
@@ -181,8 +181,10 @@ static int mpfs_probe(struct platform_device *pdev)
 	glue->clk = clk;
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
+	if (!pdata) {
+		ret = -ENOMEM;
 		goto err_clk_disable;
+	}
 
 	pdata->config = &mpfs_musb_hdrc_config;
 	pdata->platform_ops = &mpfs_ops;
@@ -197,6 +199,7 @@ static int mpfs_probe(struct platform_device *pdev)
 	if (IS_ERR(glue->phy)) {
 		dev_err(dev, "failed to register usb-phy %ld\n",
 			PTR_ERR(glue->phy));
+		ret = PTR_ERR(glue->phy);
 		goto err_clk_disable;
 	}
 
Signature · 1 line
2.35.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 36 lines · Dan Carpenter

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

These error paths return success but they need to return a negative error code.

Fixes 7a96b6ea90a4 ("usb: musb: Add support for PolarFire SoC's musb controller")
---
  drivers/usb/musb/mpfs.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/musb/mpfs.c +4 -2
index 99666ef8af06..a69ca338eace 100644
@@ -181,8 +181,10 @@ static int mpfs_probe(struct platform_device *pdev)
         glue->clk = clk;
 
         pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-       if (!pdata)
+       if (!pdata) {
+               ret = -ENOMEM;
                 goto err_clk_disable;
+       }
 
         pdata->config = &mpfs_musb_hdrc_config;
         pdata->platform_ops = &mpfs_ops;
@@ -197,6 +199,7 @@ static int mpfs_probe(struct platform_device *pdev)
         if (IS_ERR(glue->phy)) {
                 dev_err(dev, "failed to register usb-phy %ld\n",
                         PTR_ERR(glue->phy));
+               ret = PTR_ERR(glue->phy);
                 goto err_clk_disable;
         }
 
--
Quoted 2 lines

2.35.1

Thanks Dan and sorry for the bother!
Conor.