mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 next] regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()
@ 2025-08-18 12:30 Dan Carpenter
  2025-08-19 19:47 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-08-18 12:30 UTC (permalink / raw)
  To: Jeff Chang; +Cc: Liam Girdwood, Mark Brown, linux-kernel, kernel-janitors

The "priv->cdata" pointer isn't an error pointer; this should be a NULL
check instead.  Otherwise it leads to a NULL pointer dereference in the
caller, rt5133_probe().

Fixes: 714165e1c4b0 ("regulator: rt5133: Add RT5133 PMIC regulator Support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: rebase

 drivers/regulator/rt5133-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/rt5133-regulator.c b/drivers/regulator/rt5133-regulator.c
index 39532618e73d..129b1f13c880 100644
--- a/drivers/regulator/rt5133-regulator.c
+++ b/drivers/regulator/rt5133-regulator.c
@@ -510,7 +510,7 @@ static int rt5133_validate_vendor_info(struct rt5133_priv *priv)
 			break;
 		}
 	}
-	if (IS_ERR(priv->cdata)) {
+	if (!priv->cdata) {
 		dev_err(priv->dev, "Failed to find regulator match version\n");
 		return -ENODEV;
 	}
-- 
2.47.2


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

end of thread, other threads:[~2025-08-19 19:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-18 12:30 [PATCH v2 next] regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info() Dan Carpenter
2025-08-19 19:47 ` Mark Brown

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

all inboxes | Powered by JetHome®