Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: musb: mpfs: Fix error codes in probe()
@ 2022-06-24  7:22 Dan Carpenter
  2022-06-24 18:19 ` Conor.Dooley
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-06-24  7:22 UTC (permalink / raw)
  To: Lewis Hanly, Conor Dooley
  Cc: Bin Liu, Greg Kroah-Hartman, linux-usb, kernel-janitors

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/musb/mpfs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
index 99666ef8af06..a69ca338eace 100644
--- a/drivers/usb/musb/mpfs.c
+++ b/drivers/usb/musb/mpfs.c
@@ -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;
 	}
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: musb: mpfs: Fix error codes in probe()
  2022-06-24  7:22 [PATCH] usb: musb: mpfs: Fix error codes in probe() Dan Carpenter
@ 2022-06-24 18:19 ` Conor.Dooley
  0 siblings, 0 replies; 2+ messages in thread
From: Conor.Dooley @ 2022-06-24 18:19 UTC (permalink / raw)
  To: dan.carpenter, Lewis.Hanly; +Cc: b-liu, gregkh, linux-usb, kernel-janitors

On 24/06/2022 08:22, Dan Carpenter wrote:
> 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")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   drivers/usb/musb/mpfs.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c
> index 99666ef8af06..a69ca338eace 100644
> --- a/drivers/usb/musb/mpfs.c
> +++ b/drivers/usb/musb/mpfs.c
> @@ -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;
>          }
> 
> --
> 2.35.1
> 

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks Dan and sorry for the bother!
Conor.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-24 18:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-24  7:22 [PATCH] usb: musb: mpfs: Fix error codes in probe() Dan Carpenter
2022-06-24 18:19 ` Conor.Dooley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox