lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] of/platform: Avoid compilation warning
Hi Rob,

Rob Herring <robh@kernel.org> wrote on Wed, 27 May 2020 12:35:55 -0600:

> On Thu, May 14, 2020 at 07:07:07PM +0200, Miquel Raynal wrote:
> > The of_find_device_by_node() helper has its dummy counterpart for when
> > CONFIG_OF is not enabled. However, it is clearly stated in the kernel
> > documentation that it "takes a reference to the embedded struct device
> > which needs to be dropped after use". Which means the of_dev_put()
> > helper might have to be called afterwards. Unfortunately, there is no
> > of_dev_put() dummy function if OF_CONFIG is not enabled which seems
> > odd in this case. The of_dev_put() helper is pretty simple, it just
> > checks the validity of the single argument and calls put_device() on
> > it. One can just call put_device() directly to avoid any build issue
> > but I find much more accurate in this case to create the dummy
> > helper.
> >
> > With this helper, a file using of_find_device_by_node() can also call
> > of_dev_put() without triggering the following:
>
> IMO, you should use platform_device_put() instead. It has the NULL check
> too.
>
> I imagine of_dev_put() is left over from when OF devices were not
> platform devices.

Ok, makes sense. Perhaps we should entirely get rid of it, I don't see
a lot of users left. Or at least update the comment I was mentioning.

Cheers,
Miquèl

\
 
 \ /
  Last update: 2020-05-28 13:04    [W:0.105 / U:0.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site