mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
hwmon: (pmbus/tps25990) Don't check for specific errors when parsing properties
Instead of checking for the specific error codes (that can be considered a layering violation to some extent) check for the property existence first and then either parse it, or apply a default value. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20260219141936.2259945-1-andriy.shevchenko@linux.intel.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
ff708b549c
commit
a69ae329d4
|
|
@ -402,12 +402,18 @@ static int tps25990_probe(struct i2c_client *client)
|
|||
{
|
||||
struct device *dev = &client->dev;
|
||||
struct pmbus_driver_info *info;
|
||||
u32 rimon = TPS25990_DEFAULT_RIMON;
|
||||
const char *propname;
|
||||
u32 rimon;
|
||||
int ret;
|
||||
|
||||
ret = device_property_read_u32(dev, "ti,rimon-micro-ohms", &rimon);
|
||||
if (ret < 0 && ret != -EINVAL)
|
||||
return dev_err_probe(dev, ret, "failed to get rimon\n");
|
||||
propname = "ti,rimon-micro-ohms";
|
||||
if (device_property_present(dev, propname)) {
|
||||
ret = device_property_read_u32(dev, propname, &rimon);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to get %s\n", propname);
|
||||
} else {
|
||||
rimon = TPS25990_DEFAULT_RIMON;
|
||||
}
|
||||
|
||||
info = devm_kmemdup(dev, &tps25990_base_info, sizeof(*info), GFP_KERNEL);
|
||||
if (!info)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user