[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230131150502.GA3591814@roeck-us.net>
Date: Tue, 31 Jan 2023 07:05:02 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Alexander Stein <alexander.stein@...tq-group.com>
Cc: Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] hwmon: (iio_hwmon) use dev_err_probe
On Tue, Jan 31, 2023 at 11:33:59AM +0100, Alexander Stein wrote:
> 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@...tq-group.com>
Applied to hwmon-next.
Thanks,
Guenter
> ---
> drivers/hwmon/iio_hwmon.c | 8 +++++---
> 1 file 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);
Powered by blists - more mailing lists