Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/aKMc1oK-7yY4cD3K@stanley.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Dan Carpenter and committed by
Mark Brown
f7f80463 550bc517

+1 -1
+1 -1
drivers/regulator/rt5133-regulator.c
··· 510 510 break; 511 511 } 512 512 } 513 - if (IS_ERR(priv->cdata)) { 513 + if (!priv->cdata) { 514 514 dev_err(priv->dev, "Failed to find regulator match version\n"); 515 515 return -ENODEV; 516 516 }