regulator: qpnp: fix memory leak when probe failed

This patch fixes the following sparse warnings:
qpnp-regulator.c:2187 qpnp_regulator_probe() warn:
possible memory leak of 'vreg'

Bug: 77543262
Test: boot
Change-Id: I115e2c992f37e91fe9b31e7e475619bb679c1ee8
Signed-off-by: David Lin <dtwlin@google.com>
This commit is contained in:
David Lin
2018-06-10 16:59:21 -07:00
committed by Bruno Martins
parent fde7ff468d
commit ed6ab4283c

View File

@@ -2184,6 +2184,7 @@ static int qpnp_regulator_probe(struct platform_device *pdev)
vreg->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!vreg->regmap) {
dev_err(&pdev->dev, "Couldn't get parent's regmap\n");
kfree(vreg);
return -EINVAL;
}