1. 04 Jun, 2021 1 commit
  2. 03 Jun, 2021 6 commits
  3. 02 Jun, 2021 1 commit
  4. 01 Jun, 2021 2 commits
    • Mark Brown's avatar
      Merge branch 'for-5.13' of... · 1a435466
      Mark Brown authored
      Merge branch 'for-5.13' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-5.14
      1a435466
    • Lukas Wunner's avatar
      spi: Cleanup on failure of initial setup · 2ec6f20b
      Lukas Wunner authored
      Commit c7299fea ("spi: Fix spi device unregister flow") changed the
      SPI core's behavior if the ->setup() hook returns an error upon adding
      an spi_device:  Before, the ->cleanup() hook was invoked to free any
      allocations that were made by ->setup().  With the commit, that's no
      longer the case, so the ->setup() hook is expected to free the
      allocations itself.
      
      I've identified 5 drivers which depend on the old behavior and am fixing
      them up hereinafter: spi-bitbang.c spi-fsl-spi.c spi-omap-uwire.c
      spi-omap2-mcspi.c spi-pxa2xx.c
      
      Importantly, ->setup() is not only invoked on spi_device *addition*:
      It may subsequently be called to *change* SPI parameters.  If changing
      these SPI parameters fails, freeing memory allocations would be wrong.
      That should only be done if the spi_device is finally destroyed.
      I am therefore using a bool "initial_setup" in 4 of the affected drivers
      to differentiate between the invocation on *adding* the spi_device and
      any subsequent invocations: spi-bitbang.c spi-fsl-spi.c spi-omap-uwire.c
      spi-omap2-mcspi.c
      
      In spi-pxa2xx.c, it seems the ->setup() hook can only fail on spi_device
      addition, not any subsequent calls.  It therefore doesn't need the bool.
      
      It's worth noting that 5 other drivers already perform a cleanup if the
      ->setup() hook fails.  Before c7299fea, they caused a double-free
      if ->setup() failed on spi_device addition.  Since the commit, they're
      fine.  These drivers are: spi-mpc512x-psc.c spi-pl022.c spi-s3c64xx.c
      spi-st-ssc4.c spi-tegra114.c
      
      (spi-pxa2xx.c also already performs a cleanup, but only in one of
      several error paths.)
      
      Fixes: c7299fea ("spi: Fix spi device unregister flow")
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Cc: Saravana Kannan <saravanak@google.com>
      Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # pxa2xx
      Link: https://lore.kernel.org/r/f76a0599469f265b69c371538794101fa37b5536.1622149321.git.lukas@wunner.deSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      2ec6f20b
  5. 26 May, 2021 1 commit
  6. 24 May, 2021 3 commits
  7. 21 May, 2021 3 commits
  8. 20 May, 2021 9 commits
  9. 18 May, 2021 12 commits
  10. 16 May, 2021 2 commits