aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/sec-core.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-03-18 08:57:50 -0400
committerLee Jones <lee.jones@linaro.org>2014-03-19 05:00:08 -0400
commit8c66eeced1989c98104783832ab445305fa8c7a3 (patch)
tree04d24dd2e725a75bf5e234369b5f3846b0f10541 /drivers/mfd/sec-core.c
parent53c31b3437a6400c6ffc2c9315680217ad84cb6d (diff)
mfd: sec-core: Fix I2C dummy device resource leak on probe failure
Dummy I2C device allocated in sec_pmic_probe() leaked if devm_regmap_init_i2c() failed. Unregister it before returning from probe. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/sec-core.c')
-rw-r--r--drivers/mfd/sec-core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index e9bf73ba6e69..91405e94cfee 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -347,7 +347,7 @@ static int sec_pmic_probe(struct i2c_client *i2c,
347 ret = PTR_ERR(sec_pmic->regmap_rtc); 347 ret = PTR_ERR(sec_pmic->regmap_rtc);
348 dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n", 348 dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n",
349 ret); 349 ret);
350 return ret; 350 goto err_regmap_rtc;
351 } 351 }
352 352
353 if (pdata && pdata->cfg_pmic_irq) 353 if (pdata && pdata->cfg_pmic_irq)
@@ -388,14 +388,15 @@ static int sec_pmic_probe(struct i2c_client *i2c,
388 } 388 }
389 389
390 if (ret) 390 if (ret)
391 goto err; 391 goto err_mfd;
392 392
393 device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); 393 device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
394 394
395 return ret; 395 return ret;
396 396
397err: 397err_mfd:
398 sec_irq_exit(sec_pmic); 398 sec_irq_exit(sec_pmic);
399err_regmap_rtc:
399 i2c_unregister_device(sec_pmic->rtc); 400 i2c_unregister_device(sec_pmic->rtc);
400 return ret; 401 return ret;
401} 402}