usb: fotg210: Switch to use dev_err_probe()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 20 Jan 2023 15:44:36 +0000 (17:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 17:12:58 +0000 (18:12 +0100)
Switch to use dev_err_probe() to simplify the error paths and
unify message template.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230120154437.22025-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/fotg210/fotg210-core.c
drivers/usb/fotg210/fotg210-hcd.c
drivers/usb/fotg210/fotg210-udc.c

index c06f8eb..ce00d94 100644 (file)
@@ -50,10 +50,8 @@ static int fotg210_gemini_init(struct fotg210 *fotg, struct resource *res,
        int ret;
 
        map = syscon_regmap_lookup_by_phandle(np, "syscon");
-       if (IS_ERR(map)) {
-               dev_err(dev, "no syscon\n");
-               return PTR_ERR(map);
-       }
+       if (IS_ERR(map))
+               return dev_err_probe(dev, PTR_ERR(map), "no syscon\n");
        fotg->map = map;
        wakeup = of_property_read_bool(np, "wakeup-source");
 
index 5a934f5..613d29f 100644 (file)
@@ -5575,8 +5575,7 @@ int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg)
        hcd = usb_create_hcd(&fotg210_fotg210_hc_driver, dev,
                        dev_name(dev));
        if (!hcd) {
-               dev_err(dev, "failed to create hcd\n");
-               retval = -ENOMEM;
+               retval = dev_err_probe(dev, -ENOMEM, "failed to create hcd\n");
                goto fail_create_hcd;
        }
 
@@ -5600,7 +5599,7 @@ int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg)
 
        retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
        if (retval) {
-               dev_err(dev, "failed to add hcd with err %d\n", retval);
+               dev_err_probe(dev, retval, "failed to add hcd\n");
                goto failed_put_hcd;
        }
        device_wakeup_enable(hcd->self.controller);
@@ -5611,8 +5610,7 @@ int fotg210_hcd_probe(struct platform_device *pdev, struct fotg210 *fotg)
 failed_put_hcd:
        usb_put_hcd(hcd);
 fail_create_hcd:
-       dev_err(dev, "init %s fail, %d\n", dev_name(dev), retval);
-       return retval;
+       return dev_err_probe(dev, retval, "init %s fail\n", dev_name(dev));
 }
 
 /*
index 21f3112..9034eaf 100644 (file)
@@ -1271,7 +1271,7 @@ int fotg210_udc_probe(struct platform_device *pdev, struct fotg210 *fotg)
        ret = request_irq(irq, fotg210_irq, IRQF_SHARED,
                          udc_name, fotg210);
        if (ret < 0) {
-               dev_err(dev, "request_irq error (%d)\n", ret);
+               dev_err_probe(dev, ret, "request_irq error\n");
                goto err_req;
        }