At 2022-07-06 19:52:44, "Andy Shevchenko" <andy.shevchenko@xxxxxxxxx> wrote: >On Wed, Jul 6, 2022 at 3:49 AM Liang He <windhl@xxxxxxx> wrote: >> At 2022-07-05 23:40:12, "Bartosz Golaszewski" <brgl@xxxxxxxx> wrote: >> >On Mon, Jul 4, 2022 at 11:13 AM Liang He <windhl@xxxxxxx> wrote: > >... > >> This patch is based on the fact that there is a call site in function 'qe_add_gpiochips()' >> of src file 'drivers\soc\fsl\qe\gpio.c'. >> >> In that function, of_mm_gpiochip_add_data() is contained in a iteration of for_each_compatible_node(), >> which will automatically increase and decrease the refcount. > >"and decrease" > > >> As there is a new reference escaped into the mm_gc->gc.of_node, we should increase the >> refcount, otherwise, there may be a premature free as we do not know the existence of >> the reference in 'mm_gc->gc.of_node'. >> >> If my understanding is wrong, please correct me. > >Yes, see above. > >-- >With Best Regards, >Andy Shevchenko Hi,Andy, I think you did not get my point. The for_each_xxx OF api has decreased the refcount, but there is a reference |ESCAPE| out of the local area, so we need additional refcounting, right? Thanks, Liang