diff options
author | Alexander Stein <alexander.stein@ew.tq-group.com> | 2023-01-31 11:33:59 +0100 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2023-02-03 07:30:11 -0800 |
commit | 1c999af509b3f834d3d65a90fb72860a6d6a8370 (patch) | |
tree | c3a775a1f417dc271a0ea24fc8a9b2db75bb7355 /drivers/hwmon/iio_hwmon.c | |
parent | e1983220ae14ae7bdc8db4fb64e78bb55122c32b (diff) | |
download | linux-1c999af509b3f834d3d65a90fb72860a6d6a8370.tar.gz linux-1c999af509b3f834d3d65a90fb72860a6d6a8370.tar.bz2 linux-1c999af509b3f834d3d65a90fb72860a6d6a8370.zip |
hwmon: (iio_hwmon) use dev_err_probe
Instead of just returning an error code, add an error message as well.
While at it, simplify the code and use a common return path.
Upon deferral this also nicely lists the following message in
/sys/kernel/debug/devices_deferred:
adc iio_hwmon: Failed to get channels
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Link: https://lore.kernel.org/r/20230131103359.625081-1-alexander.stein@ew.tq-group.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/iio_hwmon.c')
-rw-r--r-- | drivers/hwmon/iio_hwmon.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c index 3aa40893fc09..4c8a80847891 100644 --- a/drivers/hwmon/iio_hwmon.c +++ b/drivers/hwmon/iio_hwmon.c @@ -77,9 +77,11 @@ static int iio_hwmon_probe(struct platform_device *pdev) channels = devm_iio_channel_get_all(dev); if (IS_ERR(channels)) { - if (PTR_ERR(channels) == -ENODEV) - return -EPROBE_DEFER; - return PTR_ERR(channels); + ret = PTR_ERR(channels); + if (ret == -ENODEV) + ret = -EPROBE_DEFER; + return dev_err_probe(dev, ret, + "Failed to get channels\n"); } st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL); |