Re: [PATCH] mtd: partitions: fix of_node_get/put balance in parser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 10 Sep 2018 15:25:51 +0200
Boris Brezillon <boris.brezillon@xxxxxxxxxxx> wrote:

> 
> > I think if the helper was
> > named "mtd_to_of_node()" that would be much clearer for everyone and
> > of_node_get(mtd_to_of_node(mtd)) would be the way to retain a reference
> > on the OF node.
> > 
> > I don't think creating a helper for that would be better because I
> > really prefer seeing the of_node_get() in the code, meaning an
> > of_node_put() will be needed at some point.  
> 
> Again, it's mainly a matter of consistency. If people are used to call
> of_node_put() when a function returns a device_node object, then it's
> better to do the same in the MTD framework.

Just to be clear. I still want to queue this patch for 4.19-rc4. All
I'm saying is that we should consider changing the behavior of
mtd_get_of_node() (and friends) at some point, otherwise we might see
other bugs like this one in the future.

On a side note, we should probably also call of_node_get/put() when
someone updates mtd->dev.of_node through the mtd_set_of_node() helper,
and call of_node_put() when an mtd device is unregistered.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux