Messages in this thread | | | Date | Thu, 19 Nov 2015 18:58:42 -0800 | From | Brian Norris <> | Subject | Re: [PATCH v2 13/11] mtd: assign mtd->dev.of_node when creating partition devices |
| |
On Thu, Nov 12, 2015 at 02:22:20PM +0100, Boris Brezillon wrote: > On Wed, 11 Nov 2015 16:15:50 -0800 > Brian Norris <computersforpeace@gmail.com> wrote: > > IOW, I think we can grab the reference in add_mtd_device() and drop it > > in del_mtd_device(). This would handle both the partition and > > non-partition case the same. > > Hm, actually I think we need it. When you iterate over child nodes with > for_each_child_of_node(), the node is released (of_node_put() is > called) after each iteration. While this is not a problem for mtd > device registration (because the controller usually retain the > reference when add_mtd_device() is called), this is not true for the > partitions. And if the partitions are ever defined using an overlay, > this can be a problem.
Yep.
> To sum-up, I think we should retain the node reference until > add_mtd_device() has retained it, so maybe we should have a ->cleanup() > function in mtd part parsers.
OK. I'll drop my patch and send out my ->cleanup() stuff instead, so you can patch on top of that.
Brian
| |