hwmon: (pmbus) Use dev_err_probe() to filter -EPROBE_DEFER error messages
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Wed, 17 Aug 2022 13:04:00 +0000 (15:04 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 17 Aug 2022 15:30:49 +0000 (08:30 -0700)
devm_regulator_register() can return -EPROBE_DEFER, so better use
dev_err_probe() instead of dev_err(), it is less verbose in such a case.

It is also more informative, which can't hurt.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3adf1cea6e32e54c0f71f4604b4e98d992beaa71.1660741419.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/pmbus_core.c

index f10bac8860fce5e9823647c876f7cfce2a48fd2d..75cf8e20fa4d07f94276c12699b735e0d4ecc0e1 100644 (file)
@@ -3016,11 +3016,10 @@ static int pmbus_regulator_register(struct pmbus_data *data)
 
                rdev = devm_regulator_register(dev, &info->reg_desc[i],
                                               &config);
-               if (IS_ERR(rdev)) {
-                       dev_err(dev, "Failed to register %s regulator\n",
-                               info->reg_desc[i].name);
-                       return PTR_ERR(rdev);
-               }
+               if (IS_ERR(rdev))
+                       return dev_err_probe(dev, PTR_ERR(rdev),
+                                            "Failed to register %s regulator\n",
+                                            info->reg_desc[i].name);
        }
 
        return 0;