lkml.org 
[lkml]   [2019]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 1/6] fieldbus_dev: add Fieldbus Device subsystem.
On Fri, Feb 08, 2019 at 11:30:22AM -0500, Sven Van Asbroeck wrote:
> On Fri, Feb 8, 2019 at 7:18 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > > +static DEFINE_IDA(fieldbus_ida);
> >
> > You forget to destroy this ida structure when the module is removed.
> > It's a common thing to get wrong :(
> >
>
> But fieldbus_ida is allocated on the heap. So as long as calls to
> ida_simple_get() and ida_simple_remove() are matched, there
> should be no resource leak?
>
> What am I missing?

the ida structure does some internal allocations and ida_destroy() has
to be called when your code is being removed to properly free it.

Again, it's not obvious at all, but it is needed :(

thanks,

greg k-h

\
 
 \ /
  Last update: 2019-02-09 10:12    [W:0.121 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site