regulator: fix null pointer check on regmap
authorColin Ian King <colin.king@canonical.com>
Thu, 2 Jul 2020 11:56:59 +0000 (12:56 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 2 Jul 2020 15:45:45 +0000 (16:45 +0100)
The null pointer check on regmap that checks for a dev_get_regmap failure
is currently returning -ENOENT if the regmap succeeded. Fix this by adding
in the missing ! operator.

Fixes: 4fe66d5a62fb ("regulator: Add support for QCOM PMIC VBUS booster")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Addresses-Coverity: ("Dereference after null check")
Link: https://lore.kernel.org/r/20200702115659.38208-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/qcom_usb_vbus-regulator.c

index 342d923..8ba947f 100644 (file)
@@ -49,7 +49,7 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
        }
 
        regmap = dev_get_regmap(dev->parent, NULL);
-       if (regmap) {
+       if (!regmap) {
                dev_err(dev, "Failed to get regmap\n");
                return -ENOENT;
        }