Commit e936e7d4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'spi-fix-v6.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A few last minute fixes for v6.11, they're all individually
  unremarkable and only last minute due to when they came in"

* tag 'spi-fix-v6.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: nxp-fspi: fix the KASAN report out-of-bounds bug
  spi: geni-qcom: Fix incorrect free_irq() sequence
  spi: geni-qcom: Undo runtime PM changes at driver exit time
parents 1136ced4 2a8787c1
...@@ -1110,25 +1110,27 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1110,25 +1110,27 @@ static int spi_geni_probe(struct platform_device *pdev)
spin_lock_init(&mas->lock); spin_lock_init(&mas->lock);
pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_use_autosuspend(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 250); pm_runtime_set_autosuspend_delay(&pdev->dev, 250);
pm_runtime_enable(dev); ret = devm_pm_runtime_enable(dev);
if (ret)
return ret;
if (device_property_read_bool(&pdev->dev, "spi-slave")) if (device_property_read_bool(&pdev->dev, "spi-slave"))
spi->target = true; spi->target = true;
ret = geni_icc_get(&mas->se, NULL); ret = geni_icc_get(&mas->se, NULL);
if (ret) if (ret)
goto spi_geni_probe_runtime_disable; return ret;
/* Set the bus quota to a reasonable value for register access */ /* Set the bus quota to a reasonable value for register access */
mas->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(CORE_2X_50_MHZ); mas->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(CORE_2X_50_MHZ);
mas->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW; mas->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
ret = geni_icc_set_bw(&mas->se); ret = geni_icc_set_bw(&mas->se);
if (ret) if (ret)
goto spi_geni_probe_runtime_disable; return ret;
ret = spi_geni_init(mas); ret = spi_geni_init(mas);
if (ret) if (ret)
goto spi_geni_probe_runtime_disable; return ret;
/* /*
* check the mode supported and set_cs for fifo mode only * check the mode supported and set_cs for fifo mode only
...@@ -1157,8 +1159,6 @@ static int spi_geni_probe(struct platform_device *pdev) ...@@ -1157,8 +1159,6 @@ static int spi_geni_probe(struct platform_device *pdev)
free_irq(mas->irq, spi); free_irq(mas->irq, spi);
spi_geni_release_dma: spi_geni_release_dma:
spi_geni_release_dma_chan(mas); spi_geni_release_dma_chan(mas);
spi_geni_probe_runtime_disable:
pm_runtime_disable(dev);
return ret; return ret;
} }
...@@ -1170,10 +1170,9 @@ static void spi_geni_remove(struct platform_device *pdev) ...@@ -1170,10 +1170,9 @@ static void spi_geni_remove(struct platform_device *pdev)
/* Unregister _before_ disabling pm_runtime() so we stop transfers */ /* Unregister _before_ disabling pm_runtime() so we stop transfers */
spi_unregister_controller(spi); spi_unregister_controller(spi);
spi_geni_release_dma_chan(mas);
free_irq(mas->irq, spi); free_irq(mas->irq, spi);
pm_runtime_disable(&pdev->dev);
spi_geni_release_dma_chan(mas);
} }
static int __maybe_unused spi_geni_runtime_suspend(struct device *dev) static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)
......
...@@ -805,14 +805,15 @@ static void nxp_fspi_fill_txfifo(struct nxp_fspi *f, ...@@ -805,14 +805,15 @@ static void nxp_fspi_fill_txfifo(struct nxp_fspi *f,
if (i < op->data.nbytes) { if (i < op->data.nbytes) {
u32 data = 0; u32 data = 0;
int j; int j;
int remaining = op->data.nbytes - i;
/* Wait for TXFIFO empty */ /* Wait for TXFIFO empty */
ret = fspi_readl_poll_tout(f, f->iobase + FSPI_INTR, ret = fspi_readl_poll_tout(f, f->iobase + FSPI_INTR,
FSPI_INTR_IPTXWE, 0, FSPI_INTR_IPTXWE, 0,
POLL_TOUT, true); POLL_TOUT, true);
WARN_ON(ret); WARN_ON(ret);
for (j = 0; j < ALIGN(op->data.nbytes - i, 4); j += 4) { for (j = 0; j < ALIGN(remaining, 4); j += 4) {
memcpy(&data, buf + i + j, 4); memcpy(&data, buf + i + j, min_t(int, 4, remaining - j));
fspi_writel(f, data, base + FSPI_TFDR + j); fspi_writel(f, data, base + FSPI_TFDR + j);
} }
fspi_writel(f, FSPI_INTR_IPTXWE, base + FSPI_INTR); fspi_writel(f, FSPI_INTR_IPTXWE, base + FSPI_INTR);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment