kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] regulator: fix null pointer check on regmap
@ 2020-07-02 11:56 Colin King
  2020-07-02 15:47 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-07-02 11:56 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Liam Girdwood, Mark Brown,
	Wesley Cheng, linux-arm-msm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/regulator/qcom_usb_vbus-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
index 342d92373598..8ba947f3585f 100644
--- a/drivers/regulator/qcom_usb_vbus-regulator.c
+++ b/drivers/regulator/qcom_usb_vbus-regulator.c
@@ -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;
 	}
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] regulator: fix null pointer check on regmap
  2020-07-02 11:56 [PATCH][next] regulator: fix null pointer check on regmap Colin King
@ 2020-07-02 15:47 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-07-02 15:47 UTC (permalink / raw)
  To: Andy Gross, Liam Girdwood, Wesley Cheng, Bjorn Andersson,
	linux-arm-msm, Colin King
  Cc: kernel-janitors, linux-kernel

On Thu, 2 Jul 2020 12:56:59 +0100, Colin King wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-02 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 11:56 [PATCH][next] regulator: fix null pointer check on regmap Colin King
2020-07-02 15:47 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).