public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: sec-core: Fix I2C dummy device resource leak on probe failure
@ 2014-03-18 12:57 Krzysztof Kozlowski
  2014-03-19  3:46 ` Sachin Kamat
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2014-03-18 12:57 UTC (permalink / raw)
  To: Sangbeom Kim, Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Krzysztof Kozlowski

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>
---
 drivers/mfd/sec-core.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 714e2135210e..6a6168ce3f79 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -260,7 +260,7 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 		ret = PTR_ERR(sec_pmic->regmap_rtc);
 		dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n",
 			ret);
-		return ret;
+		goto err_regmap_rtc;
 	}
 
 	if (pdata && pdata->cfg_pmic_irq)
@@ -293,14 +293,15 @@ static int sec_pmic_probe(struct i2c_client *i2c,
 	}
 
 	if (ret)
-		goto err;
+		goto err_mfd;
 
 	device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup);
 
 	return ret;
 
-err:
+err_mfd:
 	sec_irq_exit(sec_pmic);
+err_regmap_rtc:
 	i2c_unregister_device(sec_pmic->rtc);
 	return ret;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mfd: sec-core: Fix I2C dummy device resource leak on probe failure
  2014-03-18 12:57 [PATCH] mfd: sec-core: Fix I2C dummy device resource leak on probe failure Krzysztof Kozlowski
@ 2014-03-19  3:46 ` Sachin Kamat
  2014-03-19  8:37   ` Lee Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Sachin Kamat @ 2014-03-19  3:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Sangbeom Kim, Samuel Ortiz, Lee Jones, LKML

On 18 March 2014 18:27, Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:
> 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>

Looks good.
Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>

-- 
With warm regards,
Sachin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mfd: sec-core: Fix I2C dummy device resource leak on probe failure
  2014-03-19  3:46 ` Sachin Kamat
@ 2014-03-19  8:37   ` Lee Jones
  0 siblings, 0 replies; 3+ messages in thread
From: Lee Jones @ 2014-03-19  8:37 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: Krzysztof Kozlowski, Sangbeom Kim, Samuel Ortiz, LKML

> On 18 March 2014 18:27, Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:
> > 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>
> 
> Looks good.
> Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>

Applied with Sachin's Ack.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-19  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-18 12:57 [PATCH] mfd: sec-core: Fix I2C dummy device resource leak on probe failure Krzysztof Kozlowski
2014-03-19  3:46 ` Sachin Kamat
2014-03-19  8:37   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox