[SRU][K][PATCH 2/4] usb: musb: mpfs: Fix error codes in probe()
Emil Renner Berthing
emil.renner.berthing at canonical.com
Mon Aug 29 13:51:46 UTC 2022
From: Dan Carpenter <dan.carpenter at oracle.com>
BugLink: https://bugs.launchpad.net/bugs/1986970
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 at oracle.com>
Link: https://lore.kernel.org/r/YrVmLEc/FOEzNdzj@kili
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit 21cdd6a0e8441461e549f0c25af9696c6c4de22c)
Signed-off-by: Emil Renner Berthing <emil.renner.berthing at canonical.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.36.1
More information about the kernel-team
mailing list