From: Dan Carpenter <dan.carpenter@linaro.org>
To: Jeff Chang <jeff_chang@richtek.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH next] regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()
Date: Fri, 15 Aug 2025 09:49:46 +0300 [thread overview]
Message-ID: <aJ7YivhlWlE6ifw1@stanley.mountain> (raw)
The "priv->cdata" pointer isn't an error pointer, it 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>
---
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 d0f367381fbb..a83a595c0609 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 regualtor match version\n");
return -ENODEV;
}
--
2.47.2
next reply other threads:[~2025-08-15 6:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 6:49 Dan Carpenter [this message]
2025-08-18 12:12 ` [PATCH next] regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info() Mark Brown
2025-08-19 19:47 ` Mark Brown
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=aJ7YivhlWlE6ifw1@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=broonie@kernel.org \
--cc=jeff_chang@richtek.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.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