Commit d445d46d7b882d80e7c0d300e1ef5430c44456e2

Authored by Linus Torvalds

Merge tag 'spi-v3.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A couple of driver specific fixes:

   - Disable DMA mode for i.MX6DL chips due to a hardware bug.

   - Don't use devm_kzalloc() outside of bind/unbind paths in the
     fsl-dspi driver, fixing memory leaks"

* tag 'spi-v3.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: imx: use pio mode for i.mx6dl
  spi: spi-fsl-dspi: Remove usage of devm_kzalloc

Showing 2 changed files Side-by-side Diff

drivers/spi/spi-fsl-dspi.c
... ... @@ -342,8 +342,7 @@
342 342 /* Only alloc on first setup */
343 343 chip = spi_get_ctldata(spi);
344 344 if (chip == NULL) {
345   - chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data),
346   - GFP_KERNEL);
  345 + chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
347 346 if (!chip)
348 347 return -ENOMEM;
349 348 }
... ... @@ -382,6 +381,16 @@
382 381 return dspi_setup_transfer(spi, NULL);
383 382 }
384 383  
  384 +static void dspi_cleanup(struct spi_device *spi)
  385 +{
  386 + struct chip_data *chip = spi_get_ctldata((struct spi_device *)spi);
  387 +
  388 + dev_dbg(&spi->dev, "spi_device %u.%u cleanup\n",
  389 + spi->master->bus_num, spi->chip_select);
  390 +
  391 + kfree(chip);
  392 +}
  393 +
385 394 static irqreturn_t dspi_interrupt(int irq, void *dev_id)
386 395 {
387 396 struct fsl_dspi *dspi = (struct fsl_dspi *)dev_id;
... ... @@ -467,6 +476,7 @@
467 476 dspi->bitbang.master->setup = dspi_setup;
468 477 dspi->bitbang.master->dev.of_node = pdev->dev.of_node;
469 478  
  479 + master->cleanup = dspi_cleanup;
470 480 master->mode_bits = SPI_CPOL | SPI_CPHA;
471 481 master->bits_per_word_mask = SPI_BPW_MASK(4) | SPI_BPW_MASK(8) |
472 482 SPI_BPW_MASK(16);
drivers/spi/spi-imx.c
... ... @@ -823,6 +823,10 @@
823 823 struct dma_slave_config slave_config = {};
824 824 int ret;
825 825  
  826 + /* use pio mode for i.mx6dl chip TKT238285 */
  827 + if (of_machine_is_compatible("fsl,imx6dl"))
  828 + return 0;
  829 +
826 830 /* Prepare for TX DMA: */
827 831 master->dma_tx = dma_request_slave_channel(dev, "tx");
828 832 if (!master->dma_tx) {