On Mon, Aug 1, 2022 at 8:35 PM Hans Verkuil <hverkuil-cisco@xxxxxxxxx> wrote: > On 01/08/2022 16:57, Andy Shevchenko wrote: > > On Mon, Aug 1, 2022 at 3:07 PM Erling Ljunggren (hljunggr) > > <hljunggr@xxxxxxxxx> wrote: > >> On Fri, 2022-07-29 at 17:51 +0200, Andy Shevchenko wrote: > >>> On Thu, Jul 28, 2022 at 1:53 PM Erling Ljunggren <hljunggr@xxxxxxxxx> > >>> wrote: ... > >>>> + state = kzalloc(sizeof(*state), GFP_KERNEL); > >>>> + if (!state) > >>>> + return -ENOMEM; > >>> > >>> devm_kzalloc() ? > >> > >> This will fail if the device is forcibly unloaded while some > >> application has the device node open. > > > > I'm not sure how it's related. Can you elaborate a bit, please? > > > > If you try to forcibly unload the device (driver) when it's open and > > it somehow succeeds, that will be a sign of lifetime issues in the > > code. > > Not with rmmod but using the unbind facility. And what is the difference? The device driver core calls the same, no? > For new media drivers we generally > want to avoid using devm_*alloc, it causes more problems than it solves. I think it's because people don't think much about the lifetime of objects. I don't think devm is an issue here. > It's unlikely to be an issue here, but I'd rather keep it as-is. OK. -- With Best Regards, Andy Shevchenko