diff options
author | Mark Brown <broonie@kernel.org> | 2021-06-01 19:33:33 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-06-01 19:33:33 +0200 |
commit | 1a435466b0d470eb9095da0efefea5f7f69acf9c (patch) | |
tree | a661a705f8236cf7bd86ff250de2f627c9f0a333 /drivers/spi/spi-omap-uwire.c | |
parent | spi: Enable tracing of the SPI setup CS selection (diff) | |
parent | spi: Cleanup on failure of initial setup (diff) | |
download | linux-1a435466b0d470eb9095da0efefea5f7f69acf9c.tar.xz linux-1a435466b0d470eb9095da0efefea5f7f69acf9c.zip |
Merge branch 'for-5.13' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-5.14
Diffstat (limited to 'drivers/spi/spi-omap-uwire.c')
-rw-r--r-- | drivers/spi/spi-omap-uwire.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c index c975e8640560..087172a193fa 100644 --- a/drivers/spi/spi-omap-uwire.c +++ b/drivers/spi/spi-omap-uwire.c @@ -424,15 +424,22 @@ done: static int uwire_setup(struct spi_device *spi) { struct uwire_state *ust = spi->controller_state; + bool initial_setup = false; + int status; if (ust == NULL) { ust = kzalloc(sizeof(*ust), GFP_KERNEL); if (ust == NULL) return -ENOMEM; spi->controller_state = ust; + initial_setup = true; } - return uwire_setup_transfer(spi, NULL); + status = uwire_setup_transfer(spi, NULL); + if (status && initial_setup) + kfree(ust); + + return status; } static void uwire_cleanup(struct spi_device *spi) |