* [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove
@ 2013-12-20 9:35 Krzysztof Kozlowski
2013-12-20 9:35 ` [PATCH 2/2] mfd: max77693: Set proper maximum register for MUIC regmap Krzysztof Kozlowski
2013-12-20 13:56 ` [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove Lee Jones
0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2013-12-20 9:35 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones, linux-kernel
Cc: Krzysztof Kozlowski, Kyungmin Park, Marek Szyprowski, stable
The regmap used by max77686 MFD driver was not freed with regmap_exit()
on driver exit. This lead to leak of resources.
Replace regmap_init_i2c() call in driver probe with initialization of
managed register map so the regmap will be properly freed by the device
management code.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: stable@vger.kernel.org
---
drivers/mfd/max77686.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 34520cbe8afb..12b3ae3aa7c5 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -104,7 +104,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
max77686->irq_gpio = pdata->irq_gpio;
max77686->irq = i2c->irq;
- max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config);
+ max77686->regmap = devm_regmap_init_i2c(i2c, &max77686_regmap_config);
if (IS_ERR(max77686->regmap)) {
ret = PTR_ERR(max77686->regmap);
dev_err(max77686->dev, "Failed to allocate register map: %d\n",
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] mfd: max77693: Set proper maximum register for MUIC regmap
2013-12-20 9:35 [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove Krzysztof Kozlowski
@ 2013-12-20 9:35 ` Krzysztof Kozlowski
2013-12-20 13:58 ` Lee Jones
2013-12-20 13:56 ` [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove Lee Jones
1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2013-12-20 9:35 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones, linux-kernel
Cc: Krzysztof Kozlowski, Kyungmin Park, Marek Szyprowski
The MUIC block in max77693 has different I2C address than PMIC. The
driver allocated two regmaps: for PMIC and MUIC. However it used the
same regmap_config (with max_register field) for both regmaps. Actual
maximum address of register for MUIC is different than for PMIC.
Define another regmap_config for MUIC with proper max_register value.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
---
drivers/mfd/max77693.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index 9f92463f4f7e..3873a54e16ff 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -107,6 +107,12 @@ static const struct regmap_config max77693_regmap_config = {
.max_register = MAX77693_PMIC_REG_END,
};
+static const struct regmap_config max77693_regmap_muic_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = MAX77693_MUIC_REG_END,
+};
+
static int max77693_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
@@ -153,7 +159,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
* before call max77693-muic probe() function.
*/
max77693->regmap_muic = devm_regmap_init_i2c(max77693->muic,
- &max77693_regmap_config);
+ &max77693_regmap_muic_config);
if (IS_ERR(max77693->regmap_muic)) {
ret = PTR_ERR(max77693->regmap_muic);
dev_err(max77693->dev,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] mfd: max77693: Set proper maximum register for MUIC regmap
2013-12-20 9:35 ` [PATCH 2/2] mfd: max77693: Set proper maximum register for MUIC regmap Krzysztof Kozlowski
@ 2013-12-20 13:58 ` Lee Jones
0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2013-12-20 13:58 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Samuel Ortiz, linux-kernel, Kyungmin Park, Marek Szyprowski
On Fri, 20 Dec 2013, Krzysztof Kozlowski wrote:
> The MUIC block in max77693 has different I2C address than PMIC. The
> driver allocated two regmaps: for PMIC and MUIC. However it used the
> same regmap_config (with max_register field) for both regmaps. Actual
> maximum address of register for MUIC is different than for PMIC.
>
> Define another regmap_config for MUIC with proper max_register value.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/mfd/max77693.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Applied, thanks.
--
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] 4+ messages in thread
* Re: [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove
2013-12-20 9:35 [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove Krzysztof Kozlowski
2013-12-20 9:35 ` [PATCH 2/2] mfd: max77693: Set proper maximum register for MUIC regmap Krzysztof Kozlowski
@ 2013-12-20 13:56 ` Lee Jones
1 sibling, 0 replies; 4+ messages in thread
From: Lee Jones @ 2013-12-20 13:56 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Samuel Ortiz, linux-kernel, Kyungmin Park, Marek Szyprowski,
stable
On Fri, 20 Dec 2013, Krzysztof Kozlowski wrote:
> The regmap used by max77686 MFD driver was not freed with regmap_exit()
> on driver exit. This lead to leak of resources.
>
> Replace regmap_init_i2c() call in driver probe with initialization of
> managed register map so the regmap will be properly freed by the device
> management code.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: stable@vger.kernel.org
> ---
> drivers/mfd/max77686.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Always happy to move to managed resources.
Applied, thanks.
--
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] 4+ messages in thread
end of thread, other threads:[~2013-12-20 13:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 9:35 [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove Krzysztof Kozlowski
2013-12-20 9:35 ` [PATCH 2/2] mfd: max77693: Set proper maximum register for MUIC regmap Krzysztof Kozlowski
2013-12-20 13:58 ` Lee Jones
2013-12-20 13:56 ` [PATCH 1/2] mfd: max77686: fix regmap resource leak on driver remove Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox