All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc
@ 2012-07-13  9:18 Sachin Kamat
  2012-07-13 11:06 ` Jean Delvare
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-07-13  9:18 UTC (permalink / raw)
  To: lm-sensors

This makes the code simpler as explicit freeing is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/hwmon/s3c-hwmon.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
index f6c26d1..b7975f8 100644
--- a/drivers/hwmon/s3c-hwmon.c
+++ b/drivers/hwmon/s3c-hwmon.c
@@ -288,7 +288,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
 		return -EINVAL;
 	}
 
-	hwmon = kzalloc(sizeof(struct s3c_hwmon), GFP_KERNEL);
+	hwmon = devm_kzalloc(&dev->dev, sizeof(struct s3c_hwmon), GFP_KERNEL);
 	if (hwmon = NULL) {
 		dev_err(&dev->dev, "no memory\n");
 		return -ENOMEM;
@@ -303,8 +303,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
 	hwmon->client = s3c_adc_register(dev, NULL, NULL, 0);
 	if (IS_ERR(hwmon->client)) {
 		dev_err(&dev->dev, "cannot register adc\n");
-		ret = PTR_ERR(hwmon->client);
-		goto err_mem;
+		return PTR_ERR(hwmon->client);
 	}
 
 	/* add attributes for our adc devices. */
@@ -363,8 +362,6 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev)
  err_registered:
 	s3c_adc_release(hwmon->client);
 
- err_mem:
-	kfree(hwmon);
 	return ret;
 }
 
-- 
1.7.4.1


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc
  2012-07-13  9:18 [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Sachin Kamat
@ 2012-07-13 11:06 ` Jean Delvare
  2012-07-13 11:25 ` Sachin Kamat
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2012-07-13 11:06 UTC (permalink / raw)
  To: lm-sensors

On Fri, 13 Jul 2012 14:36:28 +0530, Sachin Kamat wrote:
> This makes the code simpler as explicit freeing is not needed.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/hwmon/s3c-hwmon.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
>

I'm afraid Guenter was faster:

http://git.kernel.org/?p=linux/kernel/git/groeck/linux-staging.git;a=commitdiff;ho66b055060eee17b4c0c18f2d5c1efa04682e11

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc
  2012-07-13  9:18 [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Sachin Kamat
  2012-07-13 11:06 ` Jean Delvare
@ 2012-07-13 11:25 ` Sachin Kamat
  2012-07-13 14:34 ` Guenter Roeck
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-07-13 11:25 UTC (permalink / raw)
  To: lm-sensors

On 13/07/2012, Jean Delvare <khali@linux-fr.org> wrote:
> On Fri, 13 Jul 2012 14:36:28 +0530, Sachin Kamat wrote:
>> This makes the code simpler as explicit freeing is not needed.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> ---
>>  drivers/hwmon/s3c-hwmon.c |    7 ++-----
>>  1 files changed, 2 insertions(+), 5 deletions(-)
>>
>
> I'm afraid Guenter was faster:
>
> http://git.kernel.org/?p=linux/kernel/git/groeck/linux-staging.git;a=commitdiff;ho66b055060eee17b4c0c18f2d5c1efa04682e11

Oops.. :)
I did not find it in the linux-next tree.. hence was not aware..

>
> --
> Jean Delvare
>


-- 
With warm regards,
Sachin

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc
  2012-07-13  9:18 [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Sachin Kamat
  2012-07-13 11:06 ` Jean Delvare
  2012-07-13 11:25 ` Sachin Kamat
@ 2012-07-13 14:34 ` Guenter Roeck
  2012-07-13 15:01 ` Guenter Roeck
  2012-07-13 15:11 ` Sachin Kamat
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2012-07-13 14:34 UTC (permalink / raw)
  To: lm-sensors

On Fri, Jul 13, 2012 at 04:43:12PM +0530, Sachin Kamat wrote:
> On 13/07/2012, Jean Delvare <khali@linux-fr.org> wrote:
> > On Fri, 13 Jul 2012 14:36:28 +0530, Sachin Kamat wrote:
> >> This makes the code simpler as explicit freeing is not needed.
> >>
> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> >> ---
> >>  drivers/hwmon/s3c-hwmon.c |    7 ++-----
> >>  1 files changed, 2 insertions(+), 5 deletions(-)
> >>
> >
> > I'm afraid Guenter was faster:
> >
> > http://git.kernel.org/?p=linux/kernel/git/groeck/linux-staging.git;a=commitdiff;ho66b055060eee17b4c0c18f2d5c1efa04682e11
> 
> Oops.. :)
> I did not find it in the linux-next tree.. hence was not aware..
> 
No problem.

I have around 50 or so of those patches still pending in my -staging tree,
because I did not get an Acked-by or Reviewed-by.

Given that, your patch is fine ... it gives me a second Signed-off, so I can
push it forward.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc
  2012-07-13  9:18 [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Sachin Kamat
                   ` (2 preceding siblings ...)
  2012-07-13 14:34 ` Guenter Roeck
@ 2012-07-13 15:01 ` Guenter Roeck
  2012-07-13 15:11 ` Sachin Kamat
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2012-07-13 15:01 UTC (permalink / raw)
  To: lm-sensors

On Fri, Jul 13, 2012 at 02:36:28PM +0530, Sachin Kamat wrote:
> This makes the code simpler as explicit freeing is not needed.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---

Applied to -next (and dropped my own patch).

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc
  2012-07-13  9:18 [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Sachin Kamat
                   ` (3 preceding siblings ...)
  2012-07-13 15:01 ` Guenter Roeck
@ 2012-07-13 15:11 ` Sachin Kamat
  4 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-07-13 15:11 UTC (permalink / raw)
  To: lm-sensors

Hi Guenter,

On 13 July 2012 20:04, Guenter Roeck <linux@roeck-us.net> wrote:
> On Fri, Jul 13, 2012 at 04:43:12PM +0530, Sachin Kamat wrote:
>> On 13/07/2012, Jean Delvare <khali@linux-fr.org> wrote:
>> > On Fri, 13 Jul 2012 14:36:28 +0530, Sachin Kamat wrote:
>> >> This makes the code simpler as explicit freeing is not needed.
>> >>
>> >> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>> >> ---
>> >>  drivers/hwmon/s3c-hwmon.c |    7 ++-----
>> >>  1 files changed, 2 insertions(+), 5 deletions(-)
>> >>
>> >
>> > I'm afraid Guenter was faster:
>> >
>> > http://git.kernel.org/?p=linux/kernel/git/groeck/linux-staging.git;a=commitdiff;ho66b055060eee17b4c0c18f2d5c1efa04682e11
>>
>> Oops.. :)
>> I did not find it in the linux-next tree.. hence was not aware..
>>
> No problem.
>
> I have around 50 or so of those patches still pending in my -staging tree,
> because I did not get an Acked-by or Reviewed-by.
>
> Given that, your patch is fine ... it gives me a second Signed-off, so I can
> push it forward.

Thanks.

I have also submitted another patch [1]. I referred to the staging
tree pointed to by Jean and found that this patch was missing in your
tree.
Please feel free to carry it in your series if you find it ok.


[1] http://lists.lm-sensors.org/pipermail/lm-sensors/2012-July/036706.html


>
> Thanks,
> Guenter



-- 
With warm regards,
Sachin

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

end of thread, other threads:[~2012-07-13 15:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13  9:18 [lm-sensors] [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Sachin Kamat
2012-07-13 11:06 ` Jean Delvare
2012-07-13 11:25 ` Sachin Kamat
2012-07-13 14:34 ` Guenter Roeck
2012-07-13 15:01 ` Guenter Roeck
2012-07-13 15:11 ` Sachin Kamat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.