All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pengpeng Hou" <hppiscas@163.com>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: s2mps11: Propagate OF provider registration failures
Date: Sun, 06 Sep 2026 03:45:17 +0000	[thread overview]
Message-ID: <20260906034518.5FB351F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260906033651.84082-1-hppiscas@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] of_clk_add_hw_provider() unconditionally marks fwnode as initialized on failure.
--

commit 70cc7ee16e2987b440f1878c683c89d530c69a34
Author: Pengpeng Hou <hppiscas@163.com>

clk: s2mps11: Propagate OF provider registration failures

This commit updates s2mps11_clk_probe() to correctly check the return value
of of_clk_add_hw_provider() and propagate registration failures. It also
adjusts the cleanup path to handle omitted clocks.

> diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c
> index fa5ac8f673f6e..94969d97d6e99 100644
> --- a/drivers/clk/clk-s2mps11.c
> +++ b/drivers/clk/clk-s2mps11.c
[ ... ]
> @@ -192,8 +192,10 @@ static int s2mps11_clk_probe(struct platform_device *pdev)
>  		clk_data->hws[i] = &s2mps11_clks[i].hw;
>  	}
>  
> -	of_clk_add_hw_provider(s2mps11_clks->clk_np, of_clk_hw_onecell_get,
> -			       clk_data);
> +	ret = of_clk_add_hw_provider(s2mps11_clks->clk_np,
> +				     of_clk_hw_onecell_get, clk_data);
> +	if (ret)
> +		goto err_reg;

[Severity: High]
This is a pre-existing issue, but by properly propagating the error from
of_clk_add_hw_provider(), could this cause dependent consumers to fail their
probe instead of deferring?

Looking at of_clk_add_hw_provider() in drivers/clk/clk.c, if it fails, it
unconditionally marks the fwnode as initialized before returning the error:

drivers/clk/clk.c:of_clk_add_hw_provider() {
    ...
	ret = of_clk_set_defaults(np, true);
	if (ret < 0)
		of_clk_del_provider(np);

	fwnode_dev_initialized(&np->fwnode, true);

	return ret;
}

If of_clk_set_defaults() fails (e.g., returning -EPROBE_DEFER),
of_clk_del_provider() unregisters the provider and correctly marks the fwnode
uninitialized, but it is then unconditionally forced to true.

Since fw_devlink relies on this initialized state, does this trick consumers
into thinking the supplier is ready, thereby breaking the EPROBE_DEFER
mechanism for dependent devices when this failure path is taken?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260906033651.84082-1-hppiscas@163.com?part=1

  reply	other threads:[~2026-09-06  3:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06  3:36 [PATCH] clk: s2mps11: Propagate OF provider registration failures Pengpeng Hou
2026-09-06  3:45 ` sashiko-bot [this message]
2026-09-12  0:25 ` Brian Masney
2026-09-12  0:29 ` Brian Masney

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=20260906034518.5FB351F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=hppiscas@163.com \
    --cc=linux-clk@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.