]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
regulator: rt5133: Fix IS_ERR() vs NULL bug in rt5133_validate_vendor_info()
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 18 Aug 2025 12:30:14 +0000 (15:30 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 19 Aug 2025 15:52:47 +0000 (16:52 +0100)
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>
drivers/regulator/rt5133-regulator.c

index 39532618e73d49e37d60aa0f94ce4f71d02c7944..129b1f13c8802861a99da6ecb8e434e31bc90f05 100644 (file)
@@ -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;
        }