public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: qcom-spmi-adc5: Tidy up adc5_get_fw_data() error messages
Date: Sat, 5 Oct 2024 12:34:03 +0100	[thread overview]
Message-ID: <20241005123403.616697f3@jic23-huawei> (raw)
In-Reply-To: <20241004-spmi-adc5-no-channel-error-v1-1-1a43d13ae967@oss.qualcomm.com>

On Fri, 04 Oct 2024 16:11:01 -0700
Bjorn Andersson <bjorn.andersson@oss.qualcomm.com> wrote:

> In the event that no channels (child nodes) are defined, the adc5 driver
> will provide a generic error message indicating that adc5_get_fw_data()
> returned -EINVAL. In all other error cases we get two error messages,
> one helpful and the generic one.
> 
> Add a specific error message for the no channels case, and drop the
> generic one, in order to improve the generates log prints in both cases.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>

In general this seems sensible.  There seem to be prints in all other paths that
aren't -ENOMEM which is fine.
For consistency it might be nice to have a follow up that uses
dev_err_probe() in adc5_get_fw_channel_data() but that can be handled separately.

Applied to the togreg branch of iio.git and initially pushed out as
testing for 0-day to take a look.

Thanks,

Jonathan



> ---
>  drivers/iio/adc/qcom-spmi-adc5.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/adc/qcom-spmi-adc5.c b/drivers/iio/adc/qcom-spmi-adc5.c
> index 9b69f40beed8..af3c2f659f5e 100644
> --- a/drivers/iio/adc/qcom-spmi-adc5.c
> +++ b/drivers/iio/adc/qcom-spmi-adc5.c
> @@ -830,7 +830,7 @@ static int adc5_get_fw_data(struct adc5_chip *adc)
>  
>  	adc->nchannels = device_get_child_node_count(adc->dev);
>  	if (!adc->nchannels)
> -		return -EINVAL;
> +		return dev_err_probe(adc->dev, -EINVAL, "no channels defined\n");
>  
>  	adc->iio_chans = devm_kcalloc(adc->dev, adc->nchannels,
>  				       sizeof(*adc->iio_chans), GFP_KERNEL);
> @@ -903,7 +903,7 @@ static int adc5_probe(struct platform_device *pdev)
>  
>  	ret = adc5_get_fw_data(adc);
>  	if (ret)
> -		return dev_err_probe(dev, ret, "adc get dt data failed\n");
> +		return ret;
>  
>  	irq_eoc = platform_get_irq(pdev, 0);
>  	if (irq_eoc < 0) {
> 
> ---
> base-commit: 58ca61c1a866bfdaa5e19fb19a2416764f847d75
> change-id: 20241004-spmi-adc5-no-channel-error-8c3203391103
> 
> Best regards,


      reply	other threads:[~2024-10-05 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-04 23:11 [PATCH] iio: adc: qcom-spmi-adc5: Tidy up adc5_get_fw_data() error messages Bjorn Andersson
2024-10-05 11:34 ` Jonathan Cameron [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=20241005123403.616697f3@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=bjorn.andersson@oss.qualcomm.com \
    --cc=lars@metafoo.de \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@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