linux/drivers/spi
Frank Li 25f00a13dc
spi: spi-fsl-dspi: Fix crash when not using GPIO chip select
Add check for the return value of spi_get_csgpiod() to avoid passing a NULL
pointer to gpiod_direction_output(), preventing a crash when GPIO chip
select is not used.

Fix below crash:
[    4.251960] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[    4.260762] Mem abort info:
[    4.263556]   ESR = 0x0000000096000004
[    4.267308]   EC = 0x25: DABT (current EL), IL = 32 bits
[    4.272624]   SET = 0, FnV = 0
[    4.275681]   EA = 0, S1PTW = 0
[    4.278822]   FSC = 0x04: level 0 translation fault
[    4.283704] Data abort info:
[    4.286583]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
[    4.292074]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[    4.297130]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[    4.302445] [0000000000000000] user address but active_mm is swapper
[    4.308805] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[    4.315072] Modules linked in:
[    4.318124] CPU: 2 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc4-next-20241023-00008-ga20ec42c5fc1 #359
[    4.328130] Hardware name: LS1046A QDS Board (DT)
[    4.332832] pstate: 40000005 (nZcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    4.339794] pc : gpiod_direction_output+0x34/0x5c
[    4.344505] lr : gpiod_direction_output+0x18/0x5c
[    4.349208] sp : ffff80008003b8f0
[    4.352517] x29: ffff80008003b8f0 x28: 0000000000000000 x27: ffffc96bcc7e9068
[    4.359659] x26: ffffc96bcc6e00b0 x25: ffffc96bcc598398 x24: ffff447400132810
[    4.366800] x23: 0000000000000000 x22: 0000000011e1a300 x21: 0000000000020002
[    4.373940] x20: 0000000000000000 x19: 0000000000000000 x18: ffffffffffffffff
[    4.381081] x17: ffff44740016e600 x16: 0000000500000003 x15: 0000000000000007
[    4.388221] x14: 0000000000989680 x13: 0000000000020000 x12: 000000000000001e
[    4.395362] x11: 0044b82fa09b5a53 x10: 0000000000000019 x9 : 0000000000000008
[    4.402502] x8 : 0000000000000002 x7 : 0000000000000007 x6 : 0000000000000000
[    4.409641] x5 : 0000000000000200 x4 : 0000000002000000 x3 : 0000000000000000
[    4.416781] x2 : 0000000000022202 x1 : 0000000000000000 x0 : 0000000000000000
[    4.423921] Call trace:
[    4.426362]  gpiod_direction_output+0x34/0x5c (P)
[    4.431067]  gpiod_direction_output+0x18/0x5c (L)
[    4.435771]  dspi_setup+0x220/0x334

Fixes: 9e264f3f85 ("spi: Replace all spi->chip_select and spi->cs_gpiod references with function call")
Cc: stable@vger.kernel.org
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20241023203032.1388491-1-Frank.Li@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-10-23 22:37:54 +01:00
..
atmel-quadspi.c spi: atmel-quadspi: Fix wrong register value written to MR 2024-10-01 12:07:53 +01:00
internals.h spi: Rework per message DMA mapped flag to be per transfer 2024-06-10 12:49:03 +01:00
Kconfig spi: cadence: Add 64BIT Kconfig dependency 2024-07-30 14:23:14 +01:00
Makefile spi: add ch341a usb2spi driver 2024-07-08 17:01:10 +01:00
spi-airoha-snfi.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-altera-core.c spi: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:49:05 +01:00
spi-altera-dfl.c
spi-altera-platform.c spi: altera: Drop unneeded MODULE_ALIAS 2024-04-15 10:17:25 +09:00
spi-amd.c spi: spi_amd: Add support for SPI MEM framework 2024-03-25 20:30:06 +00:00
spi-amlogic-spifc-a1.c
spi-ar934x.c spi: ar934x: Use helper function devm_clk_get_enabled() 2023-09-11 01:31:52 +01:00
spi-armada-3700.c spi: armada-3700: use 'time_left' variable with wait_for_completion_timeout() 2024-04-30 23:57:26 +09:00
spi-aspeed-smc.c spi: aspeed: Use helper function devm_clk_get_enabled() 2023-09-11 01:31:54 +01:00
spi-at91-usart.c spi: at91-usart: Remove some dead code 2023-09-25 16:27:48 +02:00
spi-ath79.c spi: bitbang: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:48 +00:00
spi-atmel.c spi: remove struct spi_message::is_dma_mapped 2024-03-25 20:30:07 +00:00
spi-au1550.c spi: au1550: t->{tx,rx}_dma checks 2024-03-28 21:09:45 +00:00
spi-axi-spi-engine.c Add support for AD4000 series of ADCs 2024-07-29 16:48:44 +01:00
spi-bcm63xx-hsspi.c
spi-bcm63xx.c spi: Merge up fixes 2024-09-12 12:38:44 +01:00
spi-bcm2835.c spi: bcm2835: implement ctlr->max_transfer_size 2024-02-05 14:35:44 +00:00
spi-bcm2835aux.c spi: bcm2835aux: Use helper function devm_clk_get_enabled() 2023-09-11 01:31:57 +01:00
spi-bcm-qspi.c spi: bcm-qspi: fix SFDP BFPT read by usig mspi read 2024-01-23 13:28:03 +00:00
spi-bcm-qspi.h
spi-bcmbca-hsspi.c spi: bcmbca-hsspi: Use devm_spi_alloc_host() 2024-08-28 20:39:08 +01:00
spi-bitbang-txrx.h
spi-bitbang.c spi: bitbang: Implement support for MOSI idle state configuration 2024-07-29 01:19:52 +01:00
spi-brcmstb-qspi.c
spi-butterfly.c parport: Remove parport_driver.devmodel 2024-07-03 16:44:22 +02:00
spi-cadence-quadspi.c spi: Merge up fixes 2024-09-12 12:38:44 +01:00
spi-cadence-xspi.c spi: cadence: Make cdns_mrvl_xspi_clk_div_list static 2024-08-19 13:11:18 +01:00
spi-cadence.c spi: spi-cadence: Fix missing spi_controller_is_target() check 2024-09-30 21:55:00 +01:00
spi-cavium-octeon.c
spi-cavium-thunderx.c spi: spi-cavium-thunderx: Use helper function devm_clk_get_enabled() 2023-09-11 01:31:59 +01:00
spi-cavium.c spi: cavium: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:50 +00:00
spi-cavium.h spi: cavium: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:50 +00:00
spi-ch341.c spi: add ch341a usb2spi driver 2024-07-08 17:01:10 +01:00
spi-clps711x.c
spi-coldfire-qspi.c spi: coldfire-qspi: drop driver owner assignment 2024-03-28 13:58:41 +00:00
spi-cs42l43.c spi: cs42l43: Add speaker id support to the bridge configuration 2024-06-20 21:10:15 +01:00
spi-davinci.c spi: davinci: Adapt transfer's timeout to transfer's length 2024-08-28 13:38:02 +01:00
spi-dln2.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-dw-bt1.c spi: dw: differentiate between unsupported and invalid requests 2024-05-27 01:33:04 +01:00
spi-dw-core.c spi: dw: Use new spi_xfer_is_dma_mapped() helper 2024-06-10 12:48:58 +01:00
spi-dw-dma.c spi: dw: remove redundant assignment to variable len 2024-02-15 14:17:19 +00:00
spi-dw-mmio.c spi: dw: Bail out early on unsupported target mode 2024-05-09 17:48:06 +02:00
spi-dw-pci.c
spi-dw.h spi: dw: Convert dw_spi::num_cs to u32 2024-05-03 11:09:24 +09:00
spi-ep93xx.c spi: ep93xx: update kerneldoc comments for ep93xx_spi 2024-09-12 14:33:12 +00:00
spi-falcon.c
spi-fsi.c
spi-fsl-cpm.c spi: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:49:05 +01:00
spi-fsl-cpm.h spi: fsl: remove is_dma_mapped checks 2024-03-28 21:09:46 +00:00
spi-fsl-dspi.c spi: spi-fsl-dspi: Fix crash when not using GPIO chip select 2024-10-23 22:37:54 +01:00
spi-fsl-espi.c
spi-fsl-lib.c spi: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:49:05 +01:00
spi-fsl-lib.h
spi-fsl-lpspi.c spi: spi-fsl-lpspi: Undo runtime PM changes at driver exit time 2024-09-19 12:51:20 +02:00
spi-fsl-qspi.c
spi-fsl-spi.c spi: fsl: remove is_dma_mapped checks 2024-03-28 21:09:46 +00:00
spi-fsl-spi.h
spi-geni-qcom.c spi: geni-qcom: Fix boot warning related to pm_runtime and devres 2024-10-22 20:49:02 +01:00
spi-gpio.c spi: spi-gpio: Add support for MOSI idle state configuration 2024-07-29 01:19:53 +01:00
spi-gxp.c spi: spi-gxp: BUG: Correct spi write return value 2023-09-27 17:06:36 +02:00
spi-hisi-kunpeng.c spi: hisi-kunpeng: Add verification for the max_frequency provided by the firmware 2024-07-30 13:27:38 +01:00
spi-hisi-sfc-v3xx.c spi: hisi-sfc-v3xx: Return IRQ_NONE if no interrupts were detected 2024-01-23 15:05:18 +00:00
spi-img-spfi.c
spi-imx.c spi: spi-imx: Fix pm_runtime_set_suspended() with runtime pm enabled 2024-09-30 21:54:59 +01:00
spi-ingenic.c spi: ingenic: Use new spi_xfer_is_dma_mapped() helper 2024-06-10 12:48:59 +01:00
spi-intel-pci.c spi: intel-pci: Add support for Lunar Lake-M SPI serial flash 2024-02-12 13:41:35 +00:00
spi-intel-platform.c
spi-intel.c spi: intel: Add check devm_kasprintf() returned value 2024-08-30 12:28:17 +01:00
spi-intel.h
spi-iproc-qspi.c
spi-jcore.c
spi-lantiq-ssc.c spi: lantiq-ssc: Use helper function devm_clk_get_enabled() 2023-09-11 01:32:03 +01:00
spi-ljca.c spi: ljca: switch to use devm_spi_alloc_host() 2023-12-11 12:55:16 +00:00
spi-lm70llp.c parport: Remove parport_driver.devmodel 2024-07-03 16:44:22 +02:00
spi-loongson-core.c
spi-loongson-pci.c
spi-loongson-plat.c
spi-loongson.h
spi-loopback-test.c spi: loopback-test: drop driver owner assignment 2024-03-28 13:58:40 +00:00
spi-lp8841-rtc.c
spi-mem.c spi: Fix error code checking in spi_mem_exec_op() 2024-03-14 14:14:20 +00:00
spi-meson-spicc.c spi: meson-spicc: convert comma to semicolon 2024-07-29 01:23:24 +01:00
spi-meson-spifc.c spi: Use devm_clk_get_*() helper function to 2023-09-11 22:43:17 +01:00
spi-microchip-core-qspi.c spi: microchip-core-qspi: fix setting spi bus clock rate 2024-05-09 06:59:19 +02:00
spi-microchip-core.c spi: microchip-core: add support for word sizes of 1 to 32 bits 2024-07-15 19:08:20 +01:00
spi-mpc52xx-psc.c spi: mpc52xx-psc: Make mpc52xx_psc_spi_transfer_one_message() static 2023-10-06 12:34:31 +01:00
spi-mpc52xx.c spi: mpc52xx: explicitly include linux/platform_device.h 2023-12-08 20:13:24 +00:00
spi-mpc512x-psc.c spi: mpc512x-psc: switch to use modern name 2023-09-11 01:31:35 +01:00
spi-mt65xx.c spi: spi-mt65xx: Use threaded interrupt for non-SPIMEM transfer 2024-07-29 01:23:25 +01:00
spi-mt7621.c spi: mt7621: allow GPIO chip select lines 2024-03-25 15:03:02 +00:00
spi-mtk-nor.c spi: mtk-nor: switch to use modern name 2023-09-11 01:31:39 +01:00
spi-mtk-snfi.c spi: mtk-snfi: fix kerneldoc for mtk_snand_is_page_ops() 2024-10-21 15:33:19 +01:00
spi-mux.c spi: mux: set ctlr->bits_per_word_mask 2024-07-09 17:42:33 +01:00
spi-mxic.c spi: mxic: differentiate between unsupported and invalid requests 2024-05-27 01:33:05 +01:00
spi-mxs.c spi: mxs: Switch to RUNTIME/SYSTEM_SLEEP_PM_OPS() 2024-09-03 22:07:58 +01:00
spi-npcm-fiu.c spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP 2023-11-30 12:12:39 +00:00
spi-npcm-pspi.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-nxp-fspi.c spi: Updates for v6.12 2024-09-17 10:31:31 +02:00
spi-oc-tiny.c spi: oc-tiny: Remove unused of_gpio.h 2024-04-17 23:01:11 +09:00
spi-omap2-mcspi.c spi: Updates for v6.11 2024-07-15 18:03:43 -07:00
spi-omap-uwire.c spi: add missing MODULE_DESCRIPTION() macros 2024-06-10 12:49:05 +01:00
spi-orion.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-pci1xxxx.c spi: pci1xxxx: Use new spi_xfer_is_dma_mapped() helper 2024-06-10 12:49:01 +01:00
spi-pic32-sqi.c spi: pic32-sqi: use 'time_left' variable with wait_for_completion_timeout() 2024-04-30 23:57:29 +09:00
spi-pic32.c spi: pic32: use 'time_left' variable with wait_for_completion_timeout() 2024-04-30 23:57:30 +09:00
spi-pl022.c spi: pl022: update description of internal_cs_control() 2023-12-15 12:58:18 +00:00
spi-ppc4xx.c spi: ppc4xx: Sort headers 2024-09-02 12:56:31 +01:00
spi-pxa2xx-dma.c spi: pxa2xx: Remove DMA parameters from struct chip_data 2024-05-03 11:11:36 +09:00
spi-pxa2xx-pci.c spi: Revert "spi: Insert the missing pci_dev_put()before return" 2024-09-03 12:37:20 +01:00
spi-pxa2xx-platform.c spi: pxa2xx: Move PM runtime handling to the glue drivers 2024-08-22 13:34:06 +01:00
spi-pxa2xx.c spi: pxa2xx: Move PM runtime handling to the glue drivers 2024-08-22 13:34:06 +01:00
spi-pxa2xx.h spi: pxa2xx: Do not override dev->platform_data on probe 2024-08-22 13:34:05 +01:00
spi-qcom-qspi.c
spi-qup.c spi: Rework DMA mapped flag 2024-06-11 11:38:25 +01:00
spi-rb4xx.c
spi-realtek-rtl.c
spi-rockchip-sfc.c
spi-rockchip.c spi: rockchip: Resolve unbalanced runtime PM / system PM handling 2024-08-28 20:39:00 +01:00
spi-rpc-if.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-rspi.c spi: rspi: Get rid of unused struct rspi_plat_data 2024-03-25 17:18:22 +00:00
spi-rzv2m-csi.c spi: rzv2m-csi: Add target mode support 2023-10-09 13:14:28 +01:00
spi-s3c64xx.c spi: s3c64xx: fix timeout counters in flush_fifo 2024-10-01 19:02:01 +01:00
spi-sc18is602.c
spi-sh-hspi.c
spi-sh-msiof.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-sh-sci.c spi: bitbang: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:48 +00:00
spi-sh.c
spi-sifive.c
spi-slave-mt27xx.c spi: slave-mt27xx: switch to use target_abort 2024-09-10 12:41:40 +01:00
spi-slave-system-control.c spi: slave-system-control: switch to use spi_target_abort() 2024-09-10 12:41:38 +01:00
spi-slave-time.c spi: slave-time: switch to use spi_target_abort() 2024-09-10 12:41:37 +01:00
spi-sn-f-ospi.c
spi-sprd-adi.c spi: sprd-adi: switch to use spi_alloc_host() 2023-12-11 12:54:53 +00:00
spi-sprd.c spi: sprd: switch to use modern name 2023-12-11 12:54:53 +00:00
spi-st-ssc4.c spi: st-ssc4: switch to use modern name 2023-12-11 12:54:54 +00:00
spi-stm32-qspi.c spi: stm32: qspi: Clamp stm32_qspi_get_mode() output to CCR_BUSWIDTH_4 2024-06-18 14:48:26 +01:00
spi-stm32.c spi: stm32: fix missing device mode capability in stm32mp25 2024-10-10 12:15:18 +01:00
spi-sun4i.c spi: sun4i: use 'time_left' variable with wait_for_completion_timeout() 2024-04-30 23:57:30 +09:00
spi-sun6i.c spi: sun6i: use 'time_left' variable with wait_for_completion_timeout() 2024-04-30 23:57:31 +09:00
spi-sunplus-sp7021.c spi: sunplus-sp7021: switch to use modern name 2023-12-11 12:54:59 +00:00
spi-synquacer.c spi: synquacer: switch to use modern name 2023-12-11 12:55:00 +00:00
spi-tegra20-sflash.c spi: tegra20-sflash: switch to use modern name 2023-12-11 12:55:03 +00:00
spi-tegra20-slink.c spi: tegra20-slink: switch to use modern name 2023-12-11 12:55:04 +00:00
spi-tegra114.c spi: tegra114: switch to use modern name 2023-12-11 12:55:02 +00:00
spi-tegra210-quad.c spi: tegra210-quad: switch to use modern name 2023-12-11 12:55:05 +00:00
spi-test.h
spi-ti-qspi.c spi: spi-ti-qspi: switch to use modern name 2023-12-11 12:55:06 +00:00
spi-tle62x0.c
spi-topcliff-pch.c spi: topcliff-pch: switch to use modern name 2023-12-11 12:55:07 +00:00
spi-uniphier.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-wpcm-fiu.c spi: wpcm-fiu: Simplify with dev_err_probe() 2024-08-28 22:22:24 +01:00
spi-xcomm.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
spi-xilinx.c spi: bitbang: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:48 +00:00
spi-xlp.c spi: xlp: use 'time_left' variable with wait_for_completion_timeout() 2024-04-30 23:57:32 +09:00
spi-xtensa-xtfpga.c spi: bitbang: Follow renaming of SPI "master" to "controller" 2024-02-08 11:54:48 +00:00
spi-zynq-qspi.c spi: zynq-qspi: Replace kzalloc with kmalloc for buffer allocation 2024-09-02 19:17:44 +01:00
spi-zynqmp-gqspi.c spi: Merge up fixes 2024-09-12 12:38:44 +01:00
spi.c spi: remove spi_controller_is_slave() and spi_slave_abort() 2024-09-10 12:41:42 +01:00
spidev.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00