public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] clk: versaclock: Fix incorrect error check in versaclock_probe()
@ 2025-12-12 18:06 Kuan-Wei Chiu
  2025-12-12 18:40 ` Sean Anderson
  0 siblings, 1 reply; 3+ messages in thread
From: Kuan-Wei Chiu @ 2025-12-12 18:06 UTC (permalink / raw)
  To: lukma, trini
  Cc: andrew.goodbody, aford173, sean.anderson, jserv, eleanor15x,
	u-boot, Kuan-Wei Chiu

The error check during the registration of FODs is incorrect. The code
currently checks IS_ERR(pll_name) immediately after assigning
fod_name[n].

Since pll_name is checked in a previous block, this condition will
always be false, causing any allocation failure in
versaclock_get_name() for fod_name to be ignored. This could lead
to usage of an invalid pointer.

Fix the condition to check fod_name[n] instead.

Fixes: dcf2cee77f2d ("clk: clk_versaclock: Add support for versaclock driver")
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
 drivers/clk/clk_versaclock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk_versaclock.c b/drivers/clk/clk_versaclock.c
index 19a787eaf0c..1dbde75f180 100644
--- a/drivers/clk/clk_versaclock.c
+++ b/drivers/clk/clk_versaclock.c
@@ -945,7 +945,7 @@ int versaclock_probe(struct udevice *dev)
 	/* Register FODs */
 	for (n = 0; n < vc5->chip_info->clk_fod_cnt; n++) {
 		fod_name[n] = versaclock_get_name(dev->name, "fod", n);
-		if (IS_ERR(pll_name)) {
+		if (IS_ERR(fod_name[n])) {
 			ret = PTR_ERR(fod_name[n]);
 			goto free_fod;
 		}
-- 
2.52.0.239.gd5f0c6e74e-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-07 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-12 18:06 [PATCH] clk: versaclock: Fix incorrect error check in versaclock_probe() Kuan-Wei Chiu
2025-12-12 18:40 ` Sean Anderson
2026-04-07 10:43   ` Kuan-Wei Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox