All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marek Szyprowski" <m.szyprowski@samsung.com>, linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: samsung: exynos5-subcmu: Use pm_runtime_get_sync() during probe
Date: Thu, 15 Oct 2026 12:01:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-172780@kernel.org> (raw)
In-Reply-To: <20261015115008.600082-1-m.szyprowski@samsung.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] pm: missing error check for pm_runtime_get_sync() allows unpowered register access
- [High] clk: samsung: exynos5-subcmu: race condition on global ctx->dev
--

commit fe90e32911f3916661d4731141c07feca831815e
Author: Marek Szyprowski <m.szyprowski@samsung.com>

clk: samsung: exynos5-subcmu: Use pm_runtime_get_sync() during probe

This commit changes the probe function to use pm_runtime_get_sync() instead
of pm_runtime_get(). This ensures that the device and its power domain are
fully active before accessing clock registers during registration.

> diff --git a/drivers/clk/samsung/clk-exynos5-subcmu.c b/drivers/clk/samsung/clk-exynos5-subcmu.c
> index 3731298473013..1d7eb98b72cf8 100644
> --- a/drivers/clk/samsung/clk-exynos5-subcmu.c
> +++ b/drivers/clk/samsung/clk-exynos5-subcmu.c
> @@ -103,7 +103,7 @@ static int __init exynos5_subcmu_probe(struct platform_device *pdev)
>  
>  	pm_runtime_set_suspended(dev);
>  	pm_runtime_enable(dev);
> -	pm_runtime_get(dev);
> +	pm_runtime_get_sync(dev);

[Severity: High]
Is it safe to ignore the return value of pm_runtime_get_sync()?

If it returns a negative error code (e.g. hardware failure, regulator
issue, or timeout), proceeding to call samsung_clk_register_div() and
samsung_clk_register_gate() will read unpowered hardware registers, which
can cause a synchronous external abort or data corruption.

Should this check the return value, abort the probe, and roll back PM
operations on failure?

>  
>  	ctx->dev = dev;
>  	samsung_clk_register_div(ctx, info->div_clks, info->nr_div_clks);
>  	samsung_clk_register_gate(ctx, info->gate_clks, info->nr_gate_clks);
>  	ctx->dev = NULL;

[Severity: High]
Does assigning and clearing the shared global ctx->dev without locking
introduce a race condition during concurrent asynchronous probes?

If asynchronous probing is enabled via driver_async_probe, multiple
exynos5-subcmu devices could probe concurrently. Since pm_runtime_get_sync()
can sleep, this widens the race window where concurrent threads could
overwrite ctx->dev or prematurely clear it to NULL while another thread is
still registering its clocks.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015115008.600082-1-m.szyprowski@samsung.com?part=1

      reply	other threads:[~2026-10-15 12:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261015115020eucas1p1652dcb97079fc506b99422994680d76e@eucas1p1.samsung.com>
2026-10-15 11:50 ` [PATCH] clk: samsung: exynos5-subcmu: Use pm_runtime_get_sync() during probe Marek Szyprowski
2026-10-15 12:01   ` sashiko-bot [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=sashiko-outbox-172780@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=sashiko-reviews@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.