lkml.org 
[lkml]   [2017]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] regulator: qcom_spmi: Fix an error handling path in 'qcom_spmi_regulator_probe()'
Date
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
\
 
 \ /
  Last update: 2017-09-17 21:51    [W:0.024 / U:1.108 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site