All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Antony Kurniawan Soemardi" <linux@smankusors.com>
Cc: conor+dt@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v6 3/4] iio: adc: qcom-pm8xxx-xoadc: remove redundant error logs when reading values
Date: Mon, 11 May 2026 20:47:50 +0000	[thread overview]
Message-ID: <20260511204751.61DFCC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260510-pm8xxx-xoadc-label-v6-3-49700fd03005@smankusors.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The timeout value passed to wait_for_completion_timeout() is in microseconds but the function expects jiffies, resulting in a massively inflated wait time.
- [High] The timeout error path in pm8xxx_read_channel_rsv() fails to disable the ADC arbiter, which can cause delayed interrupts to corrupt subsequent readings.
- [Medium] Removing the error log for -ETIMEDOUT hides legitimate hardware and driver failures from dmesg.
--

commit 24271541e5551b415dc4bb4616582d63863e0096
Author: Antony Kurniawan Soemardi <linux@smankusors.com>

iio: adc: qcom-pm8xxx-xoadc: remove redundant error logs when reading values

This commit drops dev_err() logging for -EINVAL and -ETIMEDOUT cases and relies
on return values to report errors, reducing unnecessary log noise.

> diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> index 31f88cf7f7f18..282a67b46a5eb 100644
> --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
> @@ -535,10 +535,7 @@ static int pm8xxx_read_channel_rsv(struct pm8xxx_xoadc *adc,
>  		goto unlock;
>  
>  	/* Next the interrupt occurs */
> -	ret = wait_for_completion_timeout(&adc->complete,
> -					  VADC_CONV_TIME_MAX_US);
> -	if (!ret) {
> -		dev_err(adc->dev, "conversion timed out\n");
> +	if (!wait_for_completion_timeout(&adc->complete, VADC_CONV_TIME_MAX_US)) {

This is a pre-existing issue, but wait_for_completion_timeout() expects a
timeout in jiffies. Does passing VADC_CONV_TIME_MAX_US directly result in a
massively inflated wait time instead of the intended microseconds?

Also, while removing the log for an invalid channel addresses user input
noise, does completely suppressing the -ETIMEDOUT error hide legitimate
hardware or interrupt failures from dmesg? Would dev_err_ratelimited() be a
better alternative here?

>  		ret = -ETIMEDOUT;
>  		goto unlock;

This is also a pre-existing issue, but if the timeout occurs and the code
jumps directly to the unlock label, it bypasses turning off the ADC arbiter
which is handled later in the function:

pm8xxx_read_channel_rsv() {
    ...
    /* Turn off the ADC by setting the arbiter to 0 twice */
    ret = regmap_write(adc->map, ADC_ARB_USRP_CNTRL, 0);
    if (ret)
        goto unlock;
    ...
}

Does jumping to unlock leave the hardware running with its interrupt armed,
potentially causing a delayed interrupt to fire and corrupt a subsequent
reading?

>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260510-pm8xxx-xoadc-label-v6-0-49700fd03005@smankusors.com?part=3

  reply	other threads:[~2026-05-11 20:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10  7:01 [PATCH v6 0/4] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels from DT Antony Kurniawan Soemardi
2026-05-10  7:01 ` [PATCH v6 1/4] dt-bindings: iio: adc: qcom,pm8018-adc: add label property for ADC channels Antony Kurniawan Soemardi
2026-05-11  9:28   ` Linus Walleij
2026-05-11 16:29     ` Jonathan Cameron
2026-05-10  7:01 ` [PATCH v6 2/4] ARM: dts: qcom: pm8921: add labels " Antony Kurniawan Soemardi
2026-05-10  7:01 ` [PATCH v6 3/4] iio: adc: qcom-pm8xxx-xoadc: remove redundant error logs when reading values Antony Kurniawan Soemardi
2026-05-11 20:47   ` sashiko-bot [this message]
2026-05-10  7:01 ` [PATCH v6 4/4] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels Antony Kurniawan Soemardi
2026-05-10  7:19   ` Andy Shevchenko
2026-05-11  9:29   ` Linus Walleij
2026-05-11 21:13   ` sashiko-bot
2026-05-11 16:27 ` [PATCH v6 0/4] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels from DT Jonathan Cameron

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=20260511204751.61DFCC2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux@smankusors.com \
    --cc=robh@kernel.org \
    --cc=sashiko@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.