From: Jiawen Liu <liu1298662399@gmail.com>
To: Abel Vesa <abelvesa@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Cc: Peng Fan <peng.fan@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
linux-clk@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: imx31: Skip EMI enable if clock registration fails
Date: Sun, 29 Nov 2026 19:25:33 +0000 [thread overview]
Message-ID: <179598034123.2.11447790855133926836.pattern-ext-122.19@gmail.com> (raw)
EMI gate registration can return an error pointer during early i.MX31
device-tree clock initialization. imx_check_clocks() logs the failure,
then _mx31_clocks_init() passes the error pointer to clk_prepare_enable().
clk_prepare() dereferences the pointer, which can fault before the
clock provider is published.
Check the EMI slot with IS_ERR() before enabling it. Keep the
registration error in the onecell table for provider lookups and retain
the boot-time enable reference when registration succeeds.
Statically traced both registration
paths and built clk-imx31.o with LLVM 19 using ARM imx_v6_v7_defconfig
with SMP disabled and i.MX31 enabled. git diff --check and checkpatch
passed. No runtime or hardware reproduction was performed.
Fixes: 95878cbed895 ("ARM i.MX31: implement clocks using common clock framework")
Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
---
drivers/clk/imx/clk-imx31.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-imx31.c b/drivers/clk/imx/clk-imx31.c
index 962eccac63cea..4511abc2bf7d8 100644
--- a/drivers/clk/imx/clk-imx31.c
+++ b/drivers/clk/imx/clk-imx31.c
@@ -115,7 +115,8 @@ static void __init _mx31_clocks_init(void __iomem *base, unsigned long fref)
imx_check_clocks(clk, ARRAY_SIZE(clk));
clk_set_parent(clk[csi], clk[upll]);
- clk_prepare_enable(clk[emi_gate]);
+ if (!IS_ERR(clk[emi_gate]))
+ clk_prepare_enable(clk[emi_gate]);
clk_prepare_enable(clk[iim_gate]);
mx31_revision();
clk_disable_unprepare(clk[iim_gate]);
--
2.34.1
reply other threads:[~2026-11-29 19:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=179598034123.2.11447790855133926836.pattern-ext-122.19@gmail.com \
--to=liu1298662399@gmail.com \
--cc=Frank.Li@nxp.com \
--cc=abelvesa@kernel.org \
--cc=bmasney+clk@redhat.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jbrunet+clk@baylibre.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@kernel.org \
/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