Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	wsa+renesas@sang-engineering.com
Subject: Re: [PATCH 4/8] iio: adc: rzt2h: Add optional reset support
Date: Tue, 29 Sep 2026 12:58:06 +0000	[thread overview]
Message-ID: <20260929125807.35C131F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260929124248.237032-5-prabhakar.mahadev-lad.rj@bp.renesas.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] iio: pm: shared reset_control deassert_count leak on driver unbind
--

commit 2c9879cdb042266b9cb867be82cd949d29dd6f14
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

iio: adc: rzt2h: Add optional reset support

Prepare the driver for RZ/V2H(P), where the ADC has a module reset line
that is not present on RZ/T2H. Asserts the optional reset when the ADC is
runtime-suspended and deasserts it on runtime resume before calibration.
Uses a shared reset control to support SoCs where the reset line is shared.

> diff --git a/drivers/iio/adc/rzt2h_adc.c b/drivers/iio/adc/rzt2h_adc.c
> index f1a830da6f9b7..4726f892da232 100644
> --- a/drivers/iio/adc/rzt2h_adc.c
> +++ b/drivers/iio/adc/rzt2h_adc.c
[ ... ]
> @@ -706,6 +708,10 @@ static int rzt2h_adc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, adc);
>  
> +	adc->rstc = devm_reset_control_get_optional_shared(dev, NULL);
> +	if (IS_ERR(adc->rstc))
> +		return PTR_ERR(adc->rstc);
> +
>  	ret = rzt2h_adc_parse_properties(adc);
>  	if (ret)
>  		return ret;
[ ... ]
> @@ -767,10 +773,22 @@ static const struct of_device_id rzt2h_adc_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, rzt2h_adc_match);
>  
> +static int rzt2h_adc_pm_runtime_suspend(struct device *dev)
> +{
> +	struct rzt2h_adc *adc = dev_get_drvdata(dev);
> +
> +	return reset_control_assert(adc->rstc);
> +}

[Severity: High]
Does this driver leak the shared reset control's deassert count when unbound?

If the driver is unbound (e.g., via sysfs or module unload) while the device
is in the RPM_ACTIVE state, devm_pm_runtime_enable() merely calls
pm_runtime_disable() which forcibly cancels pending autosuspends without
invoking the runtime suspend callback.

This RPM_ACTIVE state is reliably reached if unbind happens while the IIO
buffer is active (where IIO core triggers an asynchronous
pm_runtime_put_autosuspend), or within 300ms (the autosuspend delay) after a
single-channel read_raw operation.

Since the driver lacks a .remove callback or custom devm action to
synchronously suspend the device on teardown, this
rzt2h_adc_pm_runtime_suspend() is completely bypassed and
reset_control_assert() is missed.

Will this cause a permanent denial of service for shared hardware resources,
preventing the physical reset line from being asserted for other ADC instances
until a reboot?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260929124248.237032-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=4

  reply	other threads:[~2026-09-29 12:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 12:42 [PATCH 0/8] Add ADC support for RZ/V2H(P) and RZ/V2N SoCs Prabhakar
2026-09-29 12:42 ` [PATCH 1/8] dt-bindings: iio: adc: renesas,r9a09g077-adc: Add RZ/V2H(P) and RZ/V2N support Prabhakar
2026-09-29 12:42 ` [PATCH 2/8] iio: adc: rzt2h: Wait for the analog part to stop after a forced stop Prabhakar
2026-09-29 12:51   ` sashiko-bot
2026-09-30  9:23   ` Andy Shevchenko
2026-09-30 16:45     ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 3/8] iio: adc: rzt2h: Add chip-specific configuration Prabhakar
2026-09-30  9:26   ` Andy Shevchenko
2026-09-30 16:59     ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 4/8] iio: adc: rzt2h: Add optional reset support Prabhakar
2026-09-29 12:58   ` sashiko-bot [this message]
2026-10-09 11:38     ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 5/8] iio: adc: rzt2h: Prepare for SoCs without sample state registers Prabhakar
2026-09-29 12:42 ` [PATCH 6/8] iio: adc: rzt2h: Prepare for SoCs with different ADC info Prabhakar
2026-09-29 12:42 ` [PATCH 7/8] iio: adc: rzt2h: Use scan type for ADC scale Prabhakar
2026-09-30  9:28   ` Andy Shevchenko
2026-09-30 17:03     ` Lad, Prabhakar
2026-09-29 12:42 ` [PATCH 8/8] iio: adc: rzt2h: Add support for RZ/V2H(P) SoC Prabhakar
2026-09-30  9:35   ` Andy Shevchenko
2026-09-30 17:14     ` Lad, Prabhakar

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=20260929125807.35C131F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=prabhakar.csengg@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=wsa+renesas@sang-engineering.com \
    /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