Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srini@kernel.org>
To: Jiawen Liu <liu1298662399@gmail.com>,
	Srinivas Kandagatla <srini@kernel.org>,
	Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] nvmem: imx-ocotp: Propagate clock setup errors from probe
Date: Tue, 1 Dec 2026 13:56:05 +0000	[thread overview]
Message-ID: <38c28f74-9653-46b1-944f-6ae5dfb6f51e@kernel.org> (raw)
In-Reply-To: <179598034049.2.7027133837868788777.pattern-ext-112.17@gmail.com>



On 11/29/26 7:25 PM, Jiawen Liu wrote:
> imx_ocotp_probe() ignores the return value of clk_prepare_enable().
> On i.MX6SL, preparing the OCOTP clock can propagate a PLL2 lock timeout
> if PLL2 is selected and the shared clock chain is unprepared. The clock
> provider can still publish the OCOTP gate if registration of the critical
> MMDC IPG gate fails to prepare that chain.
> 
> Probe then accesses the OCOTP registers without acquiring the clock,
> attempts an unmatched clk_disable_unprepare(), and can report success
> if NVMEM registration succeeds.
> 
> Return the original clock error before clearing the OCOTP status or
> registering NVMEM. On success, release the clock after clearing the
> status, before registering NVMEM.
> 
> Verified the probe and devres paths
> by source inspection, ran git diff --check and checkpatch.pl, and built
> imx-ocotp.o with Clang 19 using the ARM imx_v6_v7_defconfig.
> Runtime and hardware reproduction were not performed.
> 
> Fixes: c33c585f1b3a ("nvmem: imx-ocotp: reset error status on probe")
CC stable missing.

--srini
> Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
> ---
>  drivers/nvmem/imx-ocotp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
> index 55e07fd919a21..ecc085bb39e31 100644
> --- a/drivers/nvmem/imx-ocotp.c
> +++ b/drivers/nvmem/imx-ocotp.c
> @@ -598,6 +598,7 @@ static int imx_ocotp_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct ocotp_priv *priv;
>  	struct nvmem_device *nvmem;
> +	int ret;
>  
>  	priv = devm_kzalloc_obj(dev, *priv);
>  	if (!priv)
> @@ -622,7 +623,10 @@ static int imx_ocotp_probe(struct platform_device *pdev)
>  
>  	priv->config = &imx_ocotp_nvmem_config;
>  
> -	clk_prepare_enable(priv->clk);
> +	ret = clk_prepare_enable(priv->clk);
> +	if (ret)
> +		return ret;
> +
>  	imx_ocotp_clr_err_if_set(priv);
>  	clk_disable_unprepare(priv->clk);
>  



      parent reply	other threads:[~2026-12-01 13:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 19:25 [PATCH] nvmem: imx-ocotp: Propagate clock setup errors from probe Jiawen Liu
2026-11-30  2:41 ` Peng Fan (OSS)
2026-12-01 13:56 ` Srinivas Kandagatla [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=38c28f74-9653-46b1-944f-6ae5dfb6f51e@kernel.org \
    --to=srini@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=liu1298662399@gmail.com \
    --cc=s.hauer@pengutronix.de \
    /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