linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] hwmon: (iio_hwmon) use dev_err_probe
Date: Tue, 31 Jan 2023 07:05:02 -0800	[thread overview]
Message-ID: <20230131150502.GA3591814@roeck-us.net> (raw)
In-Reply-To: <20230131103359.625081-1-alexander.stein@ew.tq-group.com>

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@ew.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);

      reply	other threads:[~2023-01-31 15:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 10:33 [PATCH 1/1] hwmon: (iio_hwmon) use dev_err_probe Alexander Stein
2023-01-31 15:05 ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131150502.GA3591814@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=alexander.stein@ew.tq-group.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).