Skip to contentSkip to conversation

regulator: fix null pointer check on regmap

PATCH In review Colin King 2 participants 2 messages Jul 2, 2020

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 regulator: fix null pointer check on regmap

From: Colin Ian King <[email protected]>

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.

Addresses-Coverity: ("Dereference after null check")

Fixes 4fe66d5a62fb ("regulator: Add support for QCOM PMIC VBUS booster")
---
 drivers/regulator/qcom_usb_vbus-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/qcom_usb_vbus-regulator.c +1 -1
index 342d92373598..8ba947f3585f 100644
@@ -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;
 	}
Signature · 1 line
2.27.0
maintainer
#1 lore raw
Quoted 3 lines · Colin King

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.

Applied to

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

Thanks!

[1/1] regulator: fix null pointer check on regmap

      commit: 94462138f368a5e079d53d578509276e4366d0c1

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