spi: Fixes for v5.17

A few small driver specific fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmIZCKEACgkQJNaLcl1U
 h9AMRgf/SpWf3s76HBU4pRZzxvciPysC3lpPIsc4G+Fjl+tMjoq5jrjOp7PfnL7d
 L3gE/j3IQds7mGmy5KpB9oSBIA30hpZEnUiBZjurTZ+SmnttazrFoapnuo67Rbrj
 7m8R5FKrl/XbwXYFgkA02RSLIm23SD2vdqfRut6pfAfSWlKoijx5sVpjCizhnTLx
 A0eNE46upE3ODpRq5/uGBpTXcee7CfRrxlhbqFS6HQvv6j4waUGWDUgCnB3C1I68
 BVrw3eSXvDuKHeYR25zVB+46QcwnaY2FgZju/MTBO+uhvCeaq702zAdaVZ4B3M18
 waHpyBSYLOiopJ8lJC0xBe3U6mSE0g==
 =yQPz
 -----END PGP SIGNATURE-----

Merge tag 'spi-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A few small driver specific fixes"

* tag 'spi-fix-v5.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: rockchip: terminate dma transmission when slave abort
  spi: rockchip: Fix error in getting num-cs property
  spi: spi-zynq-qspi: Fix a NULL pointer dereference in zynq_qspi_exec_mem_op()
This commit is contained in:
Linus Torvalds 2022-02-25 12:37:41 -08:00
commit 4b23c6ecef
2 changed files with 13 additions and 3 deletions

View File

@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr)
{ {
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
if (atomic_read(&rs->state) & RXDMA)
dmaengine_terminate_sync(ctlr->dma_rx);
if (atomic_read(&rs->state) & TXDMA)
dmaengine_terminate_sync(ctlr->dma_tx);
atomic_set(&rs->state, 0);
spi_enable_chip(rs, false);
rs->slave_abort = true; rs->slave_abort = true;
spi_finalize_current_transfer(ctlr); spi_finalize_current_transfer(ctlr);
@ -654,7 +660,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
struct spi_controller *ctlr; struct spi_controller *ctlr;
struct resource *mem; struct resource *mem;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
u32 rsd_nsecs; u32 rsd_nsecs, num_cs;
bool slave_mode; bool slave_mode;
slave_mode = of_property_read_bool(np, "spi-slave"); slave_mode = of_property_read_bool(np, "spi-slave");
@ -764,8 +770,9 @@ static int rockchip_spi_probe(struct platform_device *pdev)
* rk spi0 has two native cs, spi1..5 one cs only * rk spi0 has two native cs, spi1..5 one cs only
* if num-cs is missing in the dts, default to 1 * if num-cs is missing in the dts, default to 1
*/ */
if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect)) if (of_property_read_u32(np, "num-cs", &num_cs))
ctlr->num_chipselect = 1; num_cs = 1;
ctlr->num_chipselect = num_cs;
ctlr->use_gpio_descriptors = true; ctlr->use_gpio_descriptors = true;
} }
ctlr->dev.of_node = pdev->dev.of_node; ctlr->dev.of_node = pdev->dev.of_node;

View File

@ -570,6 +570,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem,
if (op->dummy.nbytes) { if (op->dummy.nbytes) {
tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL); tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL);
if (!tmpbuf)
return -ENOMEM;
memset(tmpbuf, 0xff, op->dummy.nbytes); memset(tmpbuf, 0xff, op->dummy.nbytes);
reinit_completion(&xqspi->data_completion); reinit_completion(&xqspi->data_completion);
xqspi->txbuf = tmpbuf; xqspi->txbuf = tmpbuf;