Skip to content

Commit 104db05

Browse files
committed
Merge tag 'spi-fix-v6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A few small driver specific fixes, the most important being the s3c64xx change which is likely to be hit during normal operation" * tag 'spi-fix-v6.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: mchp-pci1xxx: Fix a possible null pointer dereference in pci1xxx_spi_probe spi: spi-fsl-lpspi: remove redundant spi_controller_put call spi: s3c64xx: Use DMA mode from fifo size
2 parents 2066840 + 1f886a7 commit 104db05

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

drivers/spi/spi-fsl-lpspi.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -852,39 +852,39 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
852852
fsl_lpspi->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
853853
if (IS_ERR(fsl_lpspi->base)) {
854854
ret = PTR_ERR(fsl_lpspi->base);
855-
goto out_controller_put;
855+
return ret;
856856
}
857857
fsl_lpspi->base_phys = res->start;
858858

859859
irq = platform_get_irq(pdev, 0);
860860
if (irq < 0) {
861861
ret = irq;
862-
goto out_controller_put;
862+
return ret;
863863
}
864864

865865
ret = devm_request_irq(&pdev->dev, irq, fsl_lpspi_isr, 0,
866866
dev_name(&pdev->dev), fsl_lpspi);
867867
if (ret) {
868868
dev_err(&pdev->dev, "can't get irq%d: %d\n", irq, ret);
869-
goto out_controller_put;
869+
return ret;
870870
}
871871

872872
fsl_lpspi->clk_per = devm_clk_get(&pdev->dev, "per");
873873
if (IS_ERR(fsl_lpspi->clk_per)) {
874874
ret = PTR_ERR(fsl_lpspi->clk_per);
875-
goto out_controller_put;
875+
return ret;
876876
}
877877

878878
fsl_lpspi->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
879879
if (IS_ERR(fsl_lpspi->clk_ipg)) {
880880
ret = PTR_ERR(fsl_lpspi->clk_ipg);
881-
goto out_controller_put;
881+
return ret;
882882
}
883883

884884
/* enable the clock */
885885
ret = fsl_lpspi_init_rpm(fsl_lpspi);
886886
if (ret)
887-
goto out_controller_put;
887+
return ret;
888888

889889
ret = pm_runtime_get_sync(fsl_lpspi->dev);
890890
if (ret < 0) {
@@ -945,8 +945,6 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
945945
pm_runtime_dont_use_autosuspend(fsl_lpspi->dev);
946946
pm_runtime_put_sync(fsl_lpspi->dev);
947947
pm_runtime_disable(fsl_lpspi->dev);
948-
out_controller_put:
949-
spi_controller_put(controller);
950948

951949
return ret;
952950
}

drivers/spi/spi-pci1xxxx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,8 @@ static int pci1xxxx_spi_probe(struct pci_dev *pdev, const struct pci_device_id *
725725
spi_bus->spi_int[iter] = devm_kzalloc(&pdev->dev,
726726
sizeof(struct pci1xxxx_spi_internal),
727727
GFP_KERNEL);
728+
if (!spi_bus->spi_int[iter])
729+
return -ENOMEM;
728730
spi_sub_ptr = spi_bus->spi_int[iter];
729731
spi_sub_ptr->spi_host = devm_spi_alloc_host(dev, sizeof(struct spi_controller));
730732
if (!spi_sub_ptr->spi_host)

drivers/spi/spi-s3c64xx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static bool s3c64xx_spi_can_dma(struct spi_controller *host,
430430
struct s3c64xx_spi_driver_data *sdd = spi_controller_get_devdata(host);
431431

432432
if (sdd->rx_dma.ch && sdd->tx_dma.ch)
433-
return xfer->len > sdd->fifo_depth;
433+
return xfer->len >= sdd->fifo_depth;
434434

435435
return false;
436436
}
@@ -826,10 +826,9 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host,
826826
return status;
827827
}
828828

829-
if (!is_polling(sdd) && (xfer->len > fifo_len) &&
829+
if (!is_polling(sdd) && xfer->len >= fifo_len &&
830830
sdd->rx_dma.ch && sdd->tx_dma.ch) {
831831
use_dma = 1;
832-
833832
} else if (xfer->len >= fifo_len) {
834833
tx_buf = xfer->tx_buf;
835834
rx_buf = xfer->rx_buf;

0 commit comments

Comments
 (0)