public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] regulator: max8998 - fix memory allocation size for max8998->rdev
@ 2010-08-19  2:29 Axel Lin
  2010-08-19  2:30 ` Kyungmin Park
  2010-08-20  9:27 ` Liam Girdwood
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2010-08-19  2:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Kyungmin Park, Marek Szyprowski

We only use max8998->rdev[0] .. max8998->rdev[pdata->num_regulators-1],
max8998->rdev[pdata->num_regulators] is not used.
Thus fix the memory allocation size.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
Looks like this patch is missing. So here is a resend for Liam.

 drivers/regulator/max8998.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index ab67298..fbcb385 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -549,7 +549,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 	if (!max8998)
 		return -ENOMEM;
 
-	size = sizeof(struct regulator_dev *) * (pdata->num_regulators + 1);
+	size = sizeof(struct regulator_dev *) * pdata->num_regulators;
 	max8998->rdev = kzalloc(size, GFP_KERNEL);
 	if (!max8998->rdev) {
 		kfree(max8998);
@@ -583,7 +583,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 
 	return 0;
 err:
-	for (i = 0; i <= max8998->num_regulators; i++)
+	for (i = 0; i < max8998->num_regulators; i++)
 		if (rdev[i])
 			regulator_unregister(rdev[i]);
 
@@ -599,7 +599,7 @@ static int __devexit max8998_pmic_remove(struct platform_device *pdev)
 	struct regulator_dev **rdev = max8998->rdev;
 	int i;
 
-	for (i = 0; i <= max8998->num_regulators; i++)
+	for (i = 0; i < max8998->num_regulators; i++)
 		if (rdev[i])
 			regulator_unregister(rdev[i]);
 
-- 
1.7.2




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

* Re: [PATCH RESEND] regulator: max8998 - fix memory allocation size for max8998->rdev
  2010-08-19  2:29 [PATCH RESEND] regulator: max8998 - fix memory allocation size for max8998->rdev Axel Lin
@ 2010-08-19  2:30 ` Kyungmin Park
  2010-08-20  9:27 ` Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Kyungmin Park @ 2010-08-19  2:30 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Mark Brown, Marek Szyprowski

Acked-by: Kyungmin Park <kyungmin.park@samsung.com>

On Thu, Aug 19, 2010 at 11:29 AM, Axel Lin <axel.lin@gmail.com> wrote:
> We only use max8998->rdev[0] .. max8998->rdev[pdata->num_regulators-1],
> max8998->rdev[pdata->num_regulators] is not used.
> Thus fix the memory allocation size.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
> Looks like this patch is missing. So here is a resend for Liam.
>
>  drivers/regulator/max8998.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
> index ab67298..fbcb385 100644
> --- a/drivers/regulator/max8998.c
> +++ b/drivers/regulator/max8998.c
> @@ -549,7 +549,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
>        if (!max8998)
>                return -ENOMEM;
>
> -       size = sizeof(struct regulator_dev *) * (pdata->num_regulators + 1);
> +       size = sizeof(struct regulator_dev *) * pdata->num_regulators;
>        max8998->rdev = kzalloc(size, GFP_KERNEL);
>        if (!max8998->rdev) {
>                kfree(max8998);
> @@ -583,7 +583,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
>
>        return 0;
>  err:
> -       for (i = 0; i <= max8998->num_regulators; i++)
> +       for (i = 0; i < max8998->num_regulators; i++)
>                if (rdev[i])
>                        regulator_unregister(rdev[i]);
>
> @@ -599,7 +599,7 @@ static int __devexit max8998_pmic_remove(struct platform_device *pdev)
>        struct regulator_dev **rdev = max8998->rdev;
>        int i;
>
> -       for (i = 0; i <= max8998->num_regulators; i++)
> +       for (i = 0; i < max8998->num_regulators; i++)
>                if (rdev[i])
>                        regulator_unregister(rdev[i]);
>
> --
> 1.7.2
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

* Re: [PATCH RESEND] regulator: max8998 - fix memory allocation size for max8998->rdev
  2010-08-19  2:29 [PATCH RESEND] regulator: max8998 - fix memory allocation size for max8998->rdev Axel Lin
  2010-08-19  2:30 ` Kyungmin Park
@ 2010-08-20  9:27 ` Liam Girdwood
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2010-08-20  9:27 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Mark Brown, Kyungmin Park, Marek Szyprowski

On Thu, 2010-08-19 at 10:29 +0800, Axel Lin wrote:
> We only use max8998->rdev[0] .. max8998->rdev[pdata->num_regulators-1],
> max8998->rdev[pdata->num_regulators] is not used.
> Thus fix the memory allocation size.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk


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

end of thread, other threads:[~2010-08-20  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-19  2:29 [PATCH RESEND] regulator: max8998 - fix memory allocation size for max8998->rdev Axel Lin
2010-08-19  2:30 ` Kyungmin Park
2010-08-20  9:27 ` Liam Girdwood

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