From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@pengutronix.de
Subject: Re: [PATCH 3/4] pwm: Mark free pwm IDs as used in alloc_pwms()
Date: Wed, 16 Nov 2022 10:17:08 +0200 [thread overview]
Message-ID: <Y3SchHhvLZoRO0w6@smile.fi.intel.com> (raw)
In-Reply-To: <20221115211515.3750209-4-u.kleine-koenig@pengutronix.de>
On Tue, Nov 15, 2022 at 10:15:14PM +0100, Uwe Kleine-König wrote:
> alloc_pwms() only identified a free range of IDs and this range was marked
> as used only later by pwmchip_add(). Instead let alloc_pwms() already do
> the marking (which makes the function actually allocating the range and so
> justifies the function name). This way access to the allocated_pwms
> bitfield is limited to two functions only.
This change is a bit fragile in a long term. Currently we know that we have
no points of error after alloc_pwms() in ->probe(), but if somebody misses
this in the future, we became to the case where bitmap might be exhausted
(kinda resource leakage).
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-11-16 8:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 21:15 [PATCH 0/4] pwm: Some refactoring of pwmchip_add() Uwe Kleine-König
2022-11-15 21:15 ` [PATCH 1/4] pwm: Document variables protected by pwm_lock Uwe Kleine-König
2022-11-16 8:22 ` Andy Shevchenko
2022-11-15 21:15 ` [PATCH 2/4] pwm: Reduce time the pwm_lock mutex is held in pwmchip_add() Uwe Kleine-König
2022-11-16 8:11 ` Andy Shevchenko
2022-11-17 14:00 ` Uwe Kleine-König
2022-11-17 15:33 ` Andy Shevchenko
2022-11-15 21:15 ` [PATCH 3/4] pwm: Mark free pwm IDs as used in alloc_pwms() Uwe Kleine-König
2022-11-16 8:17 ` Andy Shevchenko [this message]
2022-11-16 13:59 ` Uwe Kleine-König
2022-11-16 14:04 ` Andy Shevchenko
2022-11-15 21:15 ` [PATCH 4/4] pwm: Don't initialize list head before calling list_add() Uwe Kleine-König
2022-11-16 8:21 ` Andy Shevchenko
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=Y3SchHhvLZoRO0w6@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
/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