From: "Arnd Bergmann" <arnd@arndb.de>
To: "Peter Griffin" <peter.griffin@linaro.org>,
"Lee Jones" <lee@kernel.org>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"André Draszik" <andre.draszik@linaro.org>,
"Saravana Kannan" <saravanak@google.com>,
"William McVicker" <willmcvicker@google.com>,
"Sam Protsenko" <semen.protsenko@linaro.org>,
kernel-team@android.com
Subject: Re: [PATCH v2 1/2] mfd: syscon: add of_syscon_register_regmap() API
Date: Thu, 20 Jun 2024 13:40:23 +0200 [thread overview]
Message-ID: <73d2002a-9afa-4cfd-b835-6908d64586d6@app.fastmail.com> (raw)
In-Reply-To: <20240620112446.1286223-2-peter.griffin@linaro.org>
On Thu, Jun 20, 2024, at 13:24, Peter Griffin wrote:
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
> Changes in v2:
> - Keep syscon lock held between checking and adding entry (Krzysztof)
Unfortunately you now have a different bug:
> + /* check if syscon entry already exists */
> + spin_lock(&syscon_list_slock);
> +
> + list_for_each_entry(entry, &syscon_list, list)
> + if (entry->np == np) {
> + syscon = entry;
> + break;
> + }
> +
> + if (syscon) {
> + ret = -EEXIST;
> + goto err_unlock;
> + }
> +
> + syscon = kzalloc(sizeof(*syscon), GFP_KERNEL);
> + if (!syscon) {
> + ret = -ENOMEM;
> + goto err_unlock;
> + }
You can't use GFP_KERNEL while holding a spinlock.
I think the correct way to do this is to move the allocation
before the locked section, and then free it in the failure case.
Arnd
next prev parent reply other threads:[~2024-06-20 11:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 11:24 [PATCH v2 0/2] Add syscon of_syscon_register_regmap api Peter Griffin
2024-06-20 11:24 ` [PATCH v2 1/2] mfd: syscon: add of_syscon_register_regmap() API Peter Griffin
2024-06-20 11:40 ` Arnd Bergmann [this message]
2024-06-20 11:53 ` Peter Griffin
2024-06-20 11:24 ` [PATCH v2 2/2] soc: samsung: exynos-pmu: update to use of_syscon_register_regmap() Peter Griffin
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=73d2002a-9afa-4cfd-b835-6908d64586d6@app.fastmail.com \
--to=arnd@arndb.de \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=kernel-team@android.com \
--cc=krzk@kernel.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=peter.griffin@linaro.org \
--cc=saravanak@google.com \
--cc=semen.protsenko@linaro.org \
--cc=tudor.ambarus@linaro.org \
--cc=willmcvicker@google.com \
/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®