All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Markus Elfring" <Markus.Elfring@web.de>, linux-serial@vger.kernel.org
Subject: Re: [PATCH] serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe()
Date: Thu, 19 Nov 2026 17:18:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-223680@kernel.org> (raw)
In-Reply-To: <1333a82f-d074-487b-b3ad-c1a3496b312b@web.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] serial: sc16is7xx: double clk_disable_unprepare() in probe()
  and remove()
--

commit af406fb81a7e34a89742ecfa2081aa070c5abb01
Author: Markus Elfring <elfring@users.sourceforge.net>

serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe()

This commit replaces devm_clk_get_optional() and clk_prepare_enable() in
sc16is7xx_probe() with devm_clk_get_optional_enabled().

> diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
> index dbf38825a78ce..3af8ea93b34a4 100644
> --- a/drivers/tty/serial/sc16is7xx.c
> +++ b/drivers/tty/serial/sc16is7xx.c
> @@ -1605,14 +1605,10 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
>  		dev_dbg(dev,
>  			"No interrupt pin definition, falling back to polling mode\n");
>  
> -	s->clk = devm_clk_get_optional(dev, NULL);
> +	s->clk = devm_clk_get_optional_enabled(dev, NULL);
>  	if (IS_ERR(s->clk))
>  		return PTR_ERR(s->clk);
>  
> -	ret = clk_prepare_enable(s->clk);
> -	if (ret)
> -		return ret;
> -
>  	freq = clk_get_rate(s->clk);
>  	if (freq == 0) {
>  		if (uartclk)

[Severity: High]
Does switching to devm_clk_get_optional_enabled() cause s->clk to be
disabled and unprepared twice on probe failure or device removal?

The out_clk error path in sc16is7xx_probe() and sc16is7xx_remove() still
call clk_disable_unprepare(s->clk) manually before devres runs its own
release action, underflowing the clock enable and prepare reference counts.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/1333a82f-d074-487b-b3ad-c1a3496b312b@web.de?part=1

  reply	other threads:[~2026-11-19 17:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 17:12 [PATCH] serial: sc16is7xx: Use devm_clk_get_optional_enabled() in sc16is7xx_probe() Markus Elfring
2026-11-19 17:18 ` sashiko-bot [this message]
2026-11-19 17:36 ` Hugo Villeneuve
2026-11-19 17:43   ` Markus Elfring

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-223680@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=linux-serial@vger.kernel.org \
    --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.