lkml.org 
[lkml]   [2013]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/11] mfd: menelaus: use devm_request_irq() and devm_kzalloc()
On Wed, Feb 20, 2013 at 05:05:10PM +0900, Jingoo Han wrote:
> On Wednesday, February 20, 2013 4:31 PM, Dmitry Torokhov wrote:
> >
> > Hi Jongoo,
> >
> > On Wed, Feb 20, 2013 at 03:12:38PM +0900, Jingoo Han wrote:
> > > Use devm_request_irq() and devm_kzalloc() to make cleanup paths
> > > more simple.
> > >
> >
> > ...
> >
> > > @@ -1269,9 +1266,7 @@ static int __exit menelaus_remove(struct i2c_client *client)
> > > {
> > > struct menelaus_chip *menelaus = i2c_get_clientdata(client);
> > >
> > > - free_irq(client->irq, menelaus);
> > > flush_work(&menelaus->work);
> > > - kfree(menelaus);
> > > the_menelaus = NULL;
> > > return 0;
> >
> > This conversion is certainly wrong - you really want to disable IRQ and
> > then wait for the scheduled work to finish before freeing memory. Here
> > you flush work but nothing stops IRQ from firing and scheduling that
> > work again.
>
> Yes, you're right.
> I will use devm_free_irq() before flush_work().

Why change it at all if you have to call it manually in both error
unwinding and menelaus_remove() cases?

BTW, that __exit markup on menelaus_remove() is surprising... I am
pretty sure it can be unbound via sysfs and so there will be a nasty
oops.

--
Dmitry


\
 
 \ /
  Last update: 2013-02-20 09:41    [W:0.062 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site