summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-09-22 15:58:31 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-09-23 12:26:07 +0200
commit984f3be5910c640bbff469bb3d4679036fce6395 (patch)
treee278cea842f04d43d0cd8b69110225b9949d93fb /drivers/usb
parent2b9a8c40836930a45f42f06f98731eb9614ba86b (diff)
usb: musb: da8xx: fix error handling message in probe
We print an error message when platform_device_register_full() fails, but the initialization of the argument has been removed, as shown in this warning: drivers/usb/musb/da8xx.c: In function 'da8xx_probe': drivers/usb/musb/da8xx.c:521:3: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] This modifies the function to assign the return code before checking it, and does uses the same method in the check for usb_phy_generic_register() as well. Fixes: 947c49afe41f ("usb: musb: da8xx: Remove mach code") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/musb/da8xx.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 2358f636e48c..210b7e43a6fd 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -462,7 +462,6 @@ static int da8xx_probe(struct platform_device *pdev)
{
struct resource musb_resources[2];
struct musb_hdrc_platform_data *pdata = dev_get_platdata(&pdev->dev);
- struct platform_device *musb;
struct da8xx_glue *glue;
struct platform_device_info pinfo;
struct clk *clk;
@@ -490,9 +489,10 @@ static int da8xx_probe(struct platform_device *pdev)
pdata->platform_ops = &da8xx_ops;
glue->usb_phy = usb_phy_generic_register();
- if (IS_ERR(glue->usb_phy)) {
+ ret = PTR_ERR_OR_ZERO(glue->usb_phy);
+ if (ret) {
dev_err(&pdev->dev, "failed to register usb_phy\n");
- return PTR_ERR(glue->usb_phy);
+ return ret;
}
platform_set_drvdata(pdev, glue);
@@ -516,14 +516,14 @@ static int da8xx_probe(struct platform_device *pdev)
pinfo.data = pdata;
pinfo.size_data = sizeof(*pdata);
- glue->musb = musb = platform_device_register_full(&pinfo);
- if (IS_ERR(musb)) {
+ glue->musb = platform_device_register_full(&pinfo);
+ 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);
- return PTR_ERR(musb);
}
- return 0;
+ return ret;
}
static int da8xx_remove(struct platform_device *pdev)