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


Groups > linux.kernel > #1733525

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

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH] regulator: qcom_spmi: Fix an error handling path in 'qcom_spmi_regulator_probe()'
Date 2017-09-17 22:00 +0200
Message-ID <uqNTs-3U8-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[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

csiph-web