From: "Liang He" <windhl@126.com>
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Linus Walleij" <linus.walleij@linaro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re:Re: Re: [PATCH] gpio: gpiolib-of: Fix refcount bugs in of_mm_gpiochip_add_data()
Date: Wed, 6 Jul 2022 20:01:56 +0800 (CST) [thread overview]
Message-ID: <d6cb15d.7794.181d3636886.Coremail.windhl@126.com> (raw)
In-Reply-To: <CAHp75VdY=PD+kPOgXf-rjj2zMLF6uDrXk3-jVRB_MRiLdu=TKg@mail.gmail.com>
At 2022-07-06 19:52:44, "Andy Shevchenko" <andy.shevchenko@gmail.com> wrote:
>On Wed, Jul 6, 2022 at 3:49 AM Liang He <windhl@126.com> wrote:
>> At 2022-07-05 23:40:12, "Bartosz Golaszewski" <brgl@bgdev.pl> wrote:
>> >On Mon, Jul 4, 2022 at 11:13 AM Liang He <windhl@126.com> 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
next prev parent reply other threads:[~2022-07-06 12:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 9:13 [PATCH] gpio: gpiolib-of: Fix refcount bugs in of_mm_gpiochip_add_data() Liang He
2022-07-05 15:40 ` Bartosz Golaszewski
2022-07-06 1:12 ` Liang He
2022-07-06 11:52 ` Andy Shevchenko
2022-07-06 12:01 ` Liang He [this message]
2022-07-06 12:47 ` Linus Walleij
2022-07-06 13:19 ` Liang He
2022-07-11 12:11 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d6cb15d.7794.181d3636886.Coremail.windhl@126.com \
--to=windhl@126.com \
--cc=andy.shevchenko@gmail.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).