[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200912212232.nBLMWe5r016214@turbo.physics.adelaide.edu.au>
Date: Tue, 22 Dec 2009 09:02:40 +1030 (CST)
From: Jonathan Woithe <jwoithe@...sics.adelaide.edu.au>
To: dmitry.torokhov@...il.com (Dmitry Torokhov)
Cc: bzolnier@...il.com (Bartlomiej Zolnierkiewicz),
jwoithe@...sics.adelaide.edu.au (Jonathan Woithe),
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fujitsu-laptop: driver [un]registration fixes
Hi Dmitry
> On Wed, Jul 29, 2009 at 10:15:33PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > @@ -722,22 +722,22 @@ static int acpi_fujitsu_add(struct acpi_
> >
> > return result;
> >
> > -end:
> > +err_unregister_input_dev:
> > + input_unregister_device(input);
> > err_free_input_dev:
> > input_free_device(input);
> > err_stop:
>
> Just noticed it scanning ACPI list. You must not use input_free_device()
> after calling input_unregister_device() since unregister likely drops the
> last reference to the device and it will get freed by input core.
So what's the correct way to deal with that in this case? Something like
-end:
+err_unregister_input_dev:
+ input_unregister_device(input);
+ goto err_stop;
err_free_input_dev:
input_free_device(input);
err_stop:
(with a short comment to explain the goto) would circumvent the problem but
it looks ugly (at least to my eyes - I've never really liked "goto"s :-) ).
> For polled input devices you need to use both unregister and free though
> because polled device structure is not refcounted (but underlying input
> device is).
This isn't a polled input device AFAIK so this doesn't apply here, right?
Regards
jonathan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists