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@xxxxxxxxx> 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