linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: replace kfree with put_device
@ 2014-02-07  8:43 Levente Kurusa
  2014-02-10  0:22 ` Jingoo Han
  0 siblings, 1 reply; 5+ messages in thread
From: Levente Kurusa @ 2014-02-07  8:43 UTC (permalink / raw)
  To: LKML, Jingoo Han, Jean-Christophe Plagniol-Villard,
	Tomi Valkeinen, FBDEV list
  Cc: Levente Kurusa

As per the comments on device_register, we shouldn't call kfree()
right after a device_register() failure. Instead call put_device(),
which in turn will call bl_device_release resulting in a kfree to the
full structure.

Signed-off-by: Levente Kurusa <levex@linux.com>
---
 drivers/video/backlight/backlight.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 5d05555..20b276e 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -333,7 +333,7 @@ struct backlight_device *backlight_device_register(const char *name,
 
 	rc = device_register(&new_bd->dev);
 	if (rc) {
-		kfree(new_bd);
+		put_device(&new_bd->dev);
 		return ERR_PTR(rc);
 	}
 
-- 
1.8.3.1


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

* Re: [PATCH] backlight: replace kfree with put_device
  2014-02-07  8:43 [PATCH] backlight: replace kfree with put_device Levente Kurusa
@ 2014-02-10  0:22 ` Jingoo Han
  2014-02-10 11:13   ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Jingoo Han @ 2014-02-10  0:22 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: 'Levente Kurusa', 'LKML',
	'Jean-Christophe Plagniol-Villard',
	'Tomi Valkeinen', 'FBDEV list',
	'Bryan Wu', 'Lee Jones', 'Jingoo Han'

On Friday, February 07, 2014 5:43 PM, Levente Kurusa wrote:
> 
> As per the comments on device_register, we shouldn't call kfree()
> right after a device_register() failure. Instead call put_device(),
> which in turn will call bl_device_release resulting in a kfree to the
> full structure.
> 
> Signed-off-by: Levente Kurusa <levex@linux.com>

(+cc Bryan Wu, Lee Jones)

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> ---
>  drivers/video/backlight/backlight.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index 5d05555..20b276e 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -333,7 +333,7 @@ struct backlight_device *backlight_device_register(const char *name,
> 
>  	rc = device_register(&new_bd->dev);
>  	if (rc) {
> -		kfree(new_bd);
> +		put_device(&new_bd->dev);
>  		return ERR_PTR(rc);
>  	}
> 
> --
> 1.8.3.1


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

* Re: [PATCH] backlight: replace kfree with put_device
  2014-02-10  0:22 ` Jingoo Han
@ 2014-02-10 11:13   ` Lee Jones
  2014-02-10 17:37     ` Bryan Wu
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2014-02-10 11:13 UTC (permalink / raw)
  To: Jingoo Han
  Cc: 'Andrew Morton', 'Levente Kurusa', 'LKML',
	'Jean-Christophe Plagniol-Villard',
	'Tomi Valkeinen', 'FBDEV list',
	'Bryan Wu'

> > As per the comments on device_register, we shouldn't call kfree()
> > right after a device_register() failure. Instead call put_device(),
> > which in turn will call bl_device_release resulting in a kfree to the
> > full structure.
> > 
> > Signed-off-by: Levente Kurusa <levex@linux.com>
> 
> (+cc Bryan Wu, Lee Jones)
> 
> Acked-by: Jingoo Han <jg1.han@samsung.com>

Applied to temporary Backlight repo [1], thanks.

[1] git://git.linaro.org/people/lee.jones/backlight.git

-- 
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] 5+ messages in thread

* Re: [PATCH] backlight: replace kfree with put_device
  2014-02-10 11:13   ` Lee Jones
@ 2014-02-10 17:37     ` Bryan Wu
  2014-02-10 17:47       ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Bryan Wu @ 2014-02-10 17:37 UTC (permalink / raw)
  To: Lee Jones
  Cc: Jingoo Han, Andrew Morton, Levente Kurusa, LKML,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, FBDEV list

On Mon, Feb 10, 2014 at 3:13 AM, Lee Jones <lee.jones@linaro.org> wrote:
>> > As per the comments on device_register, we shouldn't call kfree()
>> > right after a device_register() failure. Instead call put_device(),
>> > which in turn will call bl_device_release resulting in a kfree to the
>> > full structure.
>> >
>> > Signed-off-by: Levente Kurusa <levex@linux.com>
>>
>> (+cc Bryan Wu, Lee Jones)
>>
>> Acked-by: Jingoo Han <jg1.han@samsung.com>
>
> Applied to temporary Backlight repo [1], thanks.
>
> [1] git://git.linaro.org/people/lee.jones/backlight.git
>

Great, I think we can put the Git URL into the MAINTAINS file for
Backlight subsystem after your finalize the git repo.

Thanks,
-Bryan


> --
> 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] 5+ messages in thread

* Re: [PATCH] backlight: replace kfree with put_device
  2014-02-10 17:37     ` Bryan Wu
@ 2014-02-10 17:47       ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2014-02-10 17:47 UTC (permalink / raw)
  To: Bryan Wu
  Cc: Jingoo Han, Andrew Morton, Levente Kurusa, LKML,
	Jean-Christophe Plagniol-Villard, Tomi Valkeinen, FBDEV list

> >> > As per the comments on device_register, we shouldn't call kfree()
> >> > right after a device_register() failure. Instead call put_device(),
> >> > which in turn will call bl_device_release resulting in a kfree to the
> >> > full structure.
> >> >
> >> > Signed-off-by: Levente Kurusa <levex@linux.com>
> >>
> >> (+cc Bryan Wu, Lee Jones)
> >>
> >> Acked-by: Jingoo Han <jg1.han@samsung.com>
> >
> > Applied to temporary Backlight repo [1], thanks.
> >
> > [1] git://git.linaro.org/people/lee.jones/backlight.git
> >
> 
> Great, I think we can put the Git URL into the MAINTAINS file for
> Backlight subsystem after your finalize the git repo.

Right, I plan do to this for MFD too. Before doing so I need to load
my GPG Key with lots of signatures, at Linus' request. I'm aiming for
the end of the month(ish).

-- 
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] 5+ messages in thread

end of thread, other threads:[~2014-02-10 17:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07  8:43 [PATCH] backlight: replace kfree with put_device Levente Kurusa
2014-02-10  0:22 ` Jingoo Han
2014-02-10 11:13   ` Lee Jones
2014-02-10 17:37     ` Bryan Wu
2014-02-10 17:47       ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).