Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1733525 > unrolled thread

[PATCH] regulator: qcom_spmi: Fix an error handling path in 'qcom_spmi_regulator_probe()'

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-09-17 22:00 +0200
Last post2017-09-17 22:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] regulator: qcom_spmi: Fix an error handling path in 'qcom_spmi_regulator_probe()' Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-17 22:00 +0200

#1733525 — [PATCH] regulator: qcom_spmi: Fix an error handling path in 'qcom_spmi_regulator_probe()'

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-09-17 22:00 +0200
Subject[PATCH] regulator: qcom_spmi: Fix an error handling path in 'qcom_spmi_regulator_probe()'
Message-ID<uqNTs-3U8-15@gated-at.bofh.it>
If a memory allocation fails, we should go through the error handling path,
as done elsewhere in this 'for' loop.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/regulator/qcom_spmi-regulator.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 16c5f84e06a7..fbe908a37daa 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1657,8 +1657,10 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev)
 
 	for (reg = match->data; reg->name; reg++) {
 		vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL);
-		if (!vreg)
-			return -ENOMEM;
+		if (!vreg) {
+			ret = -ENOMEM;
+			goto err;
+		}
 
 		vreg->dev = dev;
 		vreg->base = reg->base;
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web