From: Lukas Wunner <lukas@wunner.de>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Mark Brown <broonie@kernel.org>,
linux-spi <linux-spi@vger.kernel.org>,
Masahisa Kojima <masahisa.kojima@linaro.org>,
Jassi Brar <jaswinder.singh@linaro.org>
Subject: Re: [PATCH] spi: synquacer: Disable clock in probe error path
Date: Mon, 9 Nov 2020 16:04:38 +0100 [thread overview]
Message-ID: <20201109150438.GA28425@wunner.de> (raw)
In-Reply-To: <CAHp75Vc+Gi_+SAj93_Aj95R-1h=rbMH_==G9Pgg1fcp5uQQcfg@mail.gmail.com>
On Mon, Nov 09, 2020 at 04:22:38PM +0200, Andy Shevchenko wrote:
> On Mon, Nov 9, 2020 at 12:52 AM Lukas Wunner <lukas@wunner.de> wrote:
> > If the calls to platform_get_irq() or devm_request_irq() fail on probe
> > of the SynQuacer SPI driver, the clock "sspi->clk" is erroneously not
> > unprepared and disabled.
> >
> > If the clock rate "master->max_speed_hz" cannot be determined, the same
> > happens and in addition the spi_master struct is not freed.
>
> Wouldn't be better to switch over devm_add_action_or_reset() in such cases?
I'd rather prefer a devm_clk_prepare_enable(). This is common enough
to merit a function of its own.
As for the spi_master struct being leaked: I'm about to submit
a series which introduces devm_spi_alloc_master/slave() and uses
that to fix a use-after-free in 9 drivers and an spi_master leak
in 8 drivers. Patches are on this development branch:
https://github.com/l1k/linux/commits/spi_fixes
I'm too busy with this series to also look into adding a
devm_clk_prepare_enable(). Hopefully someone else can do that.
Thanks,
Lukas
next prev parent reply other threads:[~2020-11-09 15:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 22:41 [PATCH] spi: davinci: Fix use-after-free on unbind Lukas Wunner
2020-11-08 22:41 ` [PATCH] spi: lpspi: " Lukas Wunner
2020-11-12 19:39 ` Mark Brown
2020-11-08 22:41 ` [PATCH] spi: st-ssc4: Fix unbalanced pm_runtime_disable() in probe error path Lukas Wunner
2020-11-12 19:39 ` Mark Brown
2020-11-08 22:41 ` [PATCH] spi: synquacer: Disable clock " Lukas Wunner
2020-11-09 14:22 ` Andy Shevchenko
2020-11-09 15:04 ` Lukas Wunner [this message]
2020-11-12 19:39 ` Mark Brown
2020-11-08 22:41 ` [PATCH] spi: pic32: Don't leak DMA channels " Lukas Wunner
2020-11-12 19:39 ` Mark Brown
2020-11-08 22:41 ` [PATCH] spi: atmel-quadspi: Disable clock " Lukas Wunner
2020-11-09 18:56 ` Tudor.Ambarus
2020-11-10 16:03 ` Mark Brown
2020-11-09 7:26 ` [PATCH] spi: davinci: Fix use-after-free on unbind Peter Ujfalusi
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=20201109150438.GA28425@wunner.de \
--to=lukas@wunner.de \
--cc=andy.shevchenko@gmail.com \
--cc=broonie@kernel.org \
--cc=jaswinder.singh@linaro.org \
--cc=linux-spi@vger.kernel.org \
--cc=masahisa.kojima@linaro.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).