Skip to contentSkip to conversation

regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()

PATCH In review Dan Carpenter 2 participants 2 messages Aug 18, 2025 – Aug 19, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()

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")

---
v2: rebase

 drivers/regulator/rt5133-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/rt5133-regulator.c +1 -1
index 39532618e73d..129b1f13c880 100644
@@ -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;
 	}
Signature · 1 line
2.47.2
maintainer
#1 lore raw
Quoted 5 lines · Dan Carpenter

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().

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next

Thanks!

[1/1] regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()

      commit: f7f804633c91f0fbf03eefbae39eec2205191a82

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark