diff mbox

[-next] staging: nvec: don't call input_free_device() after input_unregister_device()

Message ID CAPgLHd_XHbS=RBxTJWgoJNm0MfQyzyx4Fr2OHrDCN9VKwOwakA@mail.gmail.com
State Not Applicable, archived
Headers show

Commit Message

Wei Yongjun April 24, 2013, 2:47 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

input_free_device() should only be used if input_register_device()
was not called yet or if it failed. Once device was unregistered
use input_unregister_device() and memory will be freed once last
reference to the device is dropped.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 drivers/staging/nvec/nvec_kbd.c | 1 -
 1 file changed, 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Leon Romanovsky May 2, 2013, 8:18 p.m. UTC | #1
On Wed, Apr 24, 2013 at 5:47 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> input_free_device() should only be used if input_register_device()
> was not called yet or if it failed. Once device was unregistered
> use input_unregister_device() and memory will be freed once last
> reference to the device is dropped.
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  drivers/staging/nvec/nvec_kbd.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
> index 7445ce6..bdf5a64 100644
> --- a/drivers/staging/nvec/nvec_kbd.c
> +++ b/drivers/staging/nvec/nvec_kbd.c
> @@ -170,7 +170,6 @@ fail:
>  static int nvec_kbd_remove(struct platform_device *pdev)
>  {
>         input_unregister_device(keys_dev.input);
> -       input_free_device(keys_dev.input);
>
>         return 0;
>  }
>

Hi Greg and Wei,
I sent patch which converts nvec-kbd to managed device (devm_*), so
this patch is not needed.

Thanks.

--
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | leon@leon.nu
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Marc Dietrich May 3, 2013, 7:56 a.m. UTC | #2
Hi Leon,

Am Donnerstag, 2. Mai 2013, 23:18:35 schrieb Leon Romanovsky:
> On Wed, Apr 24, 2013 at 5:47 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > 
> > input_free_device() should only be used if input_register_device()
> > was not called yet or if it failed. Once device was unregistered
> > use input_unregister_device() and memory will be freed once last
> > reference to the device is dropped.
> > 
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > ---
> > 
> >  drivers/staging/nvec/nvec_kbd.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/drivers/staging/nvec/nvec_kbd.c
> > b/drivers/staging/nvedx10c/nvec_kbd.c index 7445ce6..bdf5a64 100644
> > --- a/drivers/staging/nvec/nvec_kbd.c
> > +++ b/drivers/staging/nvec/nvec_kbd.c
> > 
> > @@ -170,7 +170,6 @@ fail:
> >  static int nvec_kbd_remove(struct platform_device *pdev)
> >  {
> >  
> >         input_unregister_device(keys_dev.input);
> > 
> > -       input_free_device(keys_dev.input);
> > 
> >         return 0;
> >  
> >  }
> 
> Hi Greg and Wei,
> I sent patch which converts nvec-kbd to managed device (devm_*), so
> this patch is not needed.

we should not confuse things again. I think Greg can merge the various patches 
(from Wei, me, and yours) in a first-come-first-serve order as he always does 
and resolve the (trivial) merge conflicts himself. I guess he won't respond 
until -rc1 is out. Beside this, I'm not sure if your patch can still go into 
3.10 so it may have to wait till 3.11.

Marc

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky May 3, 2013, 2:07 p.m. UTC | #3
On Fri, May 3, 2013 at 10:56 AM, Marc Dietrich <marvin24@gmx.de> wrote:
> Hi Leon,
>
> Am Donnerstag, 2. Mai 2013, 23:18:35 schrieb Leon Romanovsky:
>> On Wed, Apr 24, 2013 at 5:47 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
>> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> >
>> > input_free_device() should only be used if input_register_device()
>> > was not called yet or if it failed. Once device was unregistered
>> > use input_unregister_device() and memory will be freed once last
>> > reference to the device is dropped.
>> >
>> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> > ---
>> >
>> >  drivers/staging/nvec/nvec_kbd.c | 1 -
>> >  1 file changed, 1 deletion(-)
>> >
>> > diff --git a/drivers/staging/nvec/nvec_kbd.c
>> > b/drivers/staging/nvedx10c/nvec_kbd.c index 7445ce6..bdf5a64 100644
>> > --- a/drivers/staging/nvec/nvec_kbd.c
>> > +++ b/drivers/staging/nvec/nvec_kbd.c
>> >
>> > @@ -170,7 +170,6 @@ fail:
>> >  static int nvec_kbd_remove(struct platform_device *pdev)
>> >  {
>> >
>> >         input_unregister_device(keys_dev.input);
>> >
>> > -       input_free_device(keys_dev.input);
>> >
>> >         return 0;
>> >
>> >  }
>>
>> Hi Greg and Wei,
>> I sent patch which converts nvec-kbd to managed device (devm_*), so
>> this patch is not needed.
>
> we should not confuse things again. I think Greg can merge the various patches
> (from Wei, me, and yours) in a first-come-first-serve order as he always does
> and resolve the (trivial) merge conflicts himself. I guess he won't respond
> until -rc1 is out. Beside this, I'm not sure if your patch can still go into
> 3.10 so it may have to wait till 3.11.
There is no hurry to apply my patch, and I believe it will apply
without merge conflict at all. My patch removes line with
input_free_device also.



--
Leon Romanovsky | Independent Linux Consultant
        www.leon.nu | leon@leon.nu
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
gregkh@linuxfoundation.org May 13, 2013, 9:44 p.m. UTC | #4
On Thu, May 02, 2013 at 11:18:35PM +0300, Leon Romanovsky wrote:
> On Wed, Apr 24, 2013 at 5:47 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> >
> > input_free_device() should only be used if input_register_device()
> > was not called yet or if it failed. Once device was unregistered
> > use input_unregister_device() and memory will be freed once last
> > reference to the device is dropped.
> >
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > ---
> >  drivers/staging/nvec/nvec_kbd.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
> > index 7445ce6..bdf5a64 100644
> > --- a/drivers/staging/nvec/nvec_kbd.c
> > +++ b/drivers/staging/nvec/nvec_kbd.c
> > @@ -170,7 +170,6 @@ fail:
> >  static int nvec_kbd_remove(struct platform_device *pdev)
> >  {
> >         input_unregister_device(keys_dev.input);
> > -       input_free_device(keys_dev.input);
> >
> >         return 0;
> >  }
> >
> 
> Hi Greg and Wei,
> I sent patch which converts nvec-kbd to managed device (devm_*), so
> this patch is not needed.

I agree, yours is the correct fix for this, I'll take your patch
instead.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
index 7445ce6..bdf5a64 100644
--- a/drivers/staging/nvec/nvec_kbd.c
+++ b/drivers/staging/nvec/nvec_kbd.c
@@ -170,7 +170,6 @@  fail:
 static int nvec_kbd_remove(struct platform_device *pdev)
 {
 	input_unregister_device(keys_dev.input);
-	input_free_device(keys_dev.input);
 
 	return 0;
 }