From: Krzysztof Adamski <krzysztof.adamski@tieto.com>
To: Jon Hunter <jonathanh@nvidia.com>
Cc: Mark Brown <broonie@kernel.org>,
"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: regulator: core: Request GPIO before creating sysfs entries
Date: Tue, 23 Feb 2016 15:34:21 +0100 [thread overview]
Message-ID: <20160223143420.GB19954@box2.japko.eu> (raw)
In-Reply-To: <56CC6979.3050305@nvidia.com>
On Tue, Feb 23, 2016 at 02:15:21PM +0000, Jon Hunter wrote:
>Hi Krzysztof,
>
>On 23/02/16 13:56, Krzysztof Adamski wrote:
>> On Tue, Feb 23, 2016 at 01:22:38PM +0000, Jon Hunter wrote:
>>> Hi Mark, Krzysztof,
>>>
>>> It appears that commit daad134d6649 ("regulator: core: Request GPIO
>>> before creating sysfs entries") breaks boot on tegra124-nyan-big in
>>> -next today.
>>>
>>> Looking at the change, it does not appear that the exit path has been
>>> updated correctly and so if a regulator is deferred then there is a
>>> crash in the exit path. I am not sure that there is a simple way to
>>> workaround this because of fix from commit 53032dafc6b9 ("regulator
>>> core: fix double-free in regulator_register() error path") unless we
>>> move regulator_ena_gpio_free() into regulator_dev_release().
>>
>> Hi Jon,
>>
>> You are totally right about the problem but I can't see why changing
>> "goto wash" to "goto clean" in error path of regulator_ena_gpio_request
>> is not enough. What am I missing?
>
>So device_unregister() will call regulator_dev_release() which will free
>rdev (see commit 53032dafc6b9). However, rdev is needed by
>regulator_ena_gpio_free() and therefore, we need to call
>regulator_ena_gpio_free() before we call device_unregister(). So
>swapping the order will cause other problems.
>
>One possibility would be to move regulator_ena_gpio_free() into
>regulator_dev_release(). If did we could remove the
>regulator_ena_gpio_free() from regulator_unregister(). However, I have
>not looked at that in great detail. May be Mark can comment if that
>would be ok.
But in case of regulator_ena_gpio_free() failure, we shouldn't call
device_unregister() at all, since it was not yet registered and that is
exactly what "clean" does.
Best regards,
Krzysztof Adamski
next prev parent reply other threads:[~2016-02-23 14:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 8:24 [PATCH] " Krzysztof Adamski
[not found] ` <56CC5D1E.6010101@nvidia.com>
[not found] ` <20160223135650.GA19954@box2.japko.eu>
2016-02-23 14:15 ` Jon Hunter
2016-02-23 14:34 ` Krzysztof Adamski [this message]
2016-02-23 14:47 ` [PATCH] regulator: core: fix error path of regulator_ena_gpio_free Krzysztof Adamski
2016-02-23 15:18 ` Jon Hunter
2016-02-24 8:26 ` Krzysztof Adamski
2016-02-24 9:03 ` Jon Hunter
2016-02-24 8:27 ` Krzysztof Adamski
2016-02-24 9:18 ` Jon Hunter
2016-02-24 10:52 ` [PATCH v3] regulator: core: fix crash in error path of regulator_register Krzysztof Adamski
2016-02-24 9:20 ` [PATCH] regulator: core: fix error path of regulator_ena_gpio_free Jon Hunter
2016-02-25 1:46 ` Mark Brown
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=20160223143420.GB19954@box2.japko.eu \
--to=krzysztof.adamski@tieto.com \
--cc=broonie@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@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
all inboxes | Powered by JetHome®