Skip to content

Commit e936e7d

Browse files
committed
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
2 parents 1136ced + 2a8787c commit e936e7d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

drivers/spi/spi-geni-qcom.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,25 +1110,27 @@ static int spi_geni_probe(struct platform_device *pdev)
11101110
spin_lock_init(&mas->lock);
11111111
pm_runtime_use_autosuspend(&pdev->dev);
11121112
pm_runtime_set_autosuspend_delay(&pdev->dev, 250);
1113-
pm_runtime_enable(dev);
1113+
ret = devm_pm_runtime_enable(dev);
1114+
if (ret)
1115+
return ret;
11141116

11151117
if (device_property_read_bool(&pdev->dev, "spi-slave"))
11161118
spi->target = true;
11171119

11181120
ret = geni_icc_get(&mas->se, NULL);
11191121
if (ret)
1120-
goto spi_geni_probe_runtime_disable;
1122+
return ret;
11211123
/* Set the bus quota to a reasonable value for register access */
11221124
mas->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(CORE_2X_50_MHZ);
11231125
mas->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
11241126

11251127
ret = geni_icc_set_bw(&mas->se);
11261128
if (ret)
1127-
goto spi_geni_probe_runtime_disable;
1129+
return ret;
11281130

11291131
ret = spi_geni_init(mas);
11301132
if (ret)
1131-
goto spi_geni_probe_runtime_disable;
1133+
return ret;
11321134

11331135
/*
11341136
* check the mode supported and set_cs for fifo mode only
@@ -1157,8 +1159,6 @@ static int spi_geni_probe(struct platform_device *pdev)
11571159
free_irq(mas->irq, spi);
11581160
spi_geni_release_dma:
11591161
spi_geni_release_dma_chan(mas);
1160-
spi_geni_probe_runtime_disable:
1161-
pm_runtime_disable(dev);
11621162
return ret;
11631163
}
11641164

@@ -1170,10 +1170,9 @@ static void spi_geni_remove(struct platform_device *pdev)
11701170
/* Unregister _before_ disabling pm_runtime() so we stop transfers */
11711171
spi_unregister_controller(spi);
11721172

1173-
spi_geni_release_dma_chan(mas);
1174-
11751173
free_irq(mas->irq, spi);
1176-
pm_runtime_disable(&pdev->dev);
1174+
1175+
spi_geni_release_dma_chan(mas);
11771176
}
11781177

11791178
static int __maybe_unused spi_geni_runtime_suspend(struct device *dev)

drivers/spi/spi-nxp-fspi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,14 +805,15 @@ static void nxp_fspi_fill_txfifo(struct nxp_fspi *f,
805805
if (i < op->data.nbytes) {
806806
u32 data = 0;
807807
int j;
808+
int remaining = op->data.nbytes - i;
808809
/* Wait for TXFIFO empty */
809810
ret = fspi_readl_poll_tout(f, f->iobase + FSPI_INTR,
810811
FSPI_INTR_IPTXWE, 0,
811812
POLL_TOUT, true);
812813
WARN_ON(ret);
813814

814-
for (j = 0; j < ALIGN(op->data.nbytes - i, 4); j += 4) {
815-
memcpy(&data, buf + i + j, 4);
815+
for (j = 0; j < ALIGN(remaining, 4); j += 4) {
816+
memcpy(&data, buf + i + j, min_t(int, 4, remaining - j));
816817
fspi_writel(f, data, base + FSPI_TFDR + j);
817818
}
818819
fspi_writel(f, FSPI_INTR_IPTXWE, base + FSPI_INTR);

0 commit comments

Comments
 (0)