summaryrefslogtreecommitdiff
path: root/drivers/spi
AgeCommit message (Collapse)Author
3 daysMerge tag 'spi-fix-v7.4-merge-window' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi fixes from Mark Brown: "Two patches here, one a straightforward device quirk and the other a fix for a potentially nasty data corruption bug in the zynq-qspi driver" * tag 'spi-fix-v7.4-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: cs42l43: Add speaker ID quirk for Dell XPS 13 DX13260 SKU 0E54 spi: zynq-qspi: fix address buffer corruption and support 4-byte address
5 daysMerge tag 'mm-stable-2026-10-25-19-27' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Pull more MM updates from Andrew Morton: - "mm: make VMA flag semantics explicit, eliminate VM_SPECIAL" (Lorenzo Stoakes): Replace VM_SPECIAL with helpers describing mapping ownership and behavior. Enforce the mmap flag rules and convert affected drivers, removing ambiguous tests shared by driver mappings and ordinary memory. - "support kselftest on nommu platform" (Hajime Tazaki): Add opt-in mmap and mremap tests for NOMMU systems. Teach the runner to avoid its fork-dependent timeout command and document the build and runtime requirements. - "mm/collapse: separate a collapse from its callers" (Kiryl Shutsemau): Separate huge-page collapse from caller policy. Replace khugepaged identity checks with explicit permissions, and separate scanning from collapse with the mmap_lock drop in one place. - "mm: implement and use vma_has_anon_rmap(), silence KCSAN" (Lorenzo Stoakes): Provide a common helper for testing whether a VMA has anonymous reverse mappings. Document the locking rules, annotate intentional concurrent reads for KCSAN, and convert the core MM callers. - "mm/sparse: remove SECTION_MARKED_PRESENT and further cleanups" (David Hildenbrand): Remove SECTION_MARKED_PRESENT in favor of the early-section flag. Simplify sparse memory initialization, section metadata handling and related PFN validity checks. - "sh: remove NUMA and SPARSEMEM support" (Mike Rapoport): Remove SuperH NUMA and SPARSEMEM support. The extra memory banks have been unusable since the NO_BOOTMEM conversion, leaving only the code and data overhead. - "mm: Unify device DAX and HugeTLB vmemmap population paths" (Muchun Song): Unify the generic device DAX and HugeTLB vmemmap population paths and shared tail-page handling. Remove the duplicate DAX machinery while retaining the powerpc radix implementation. - "kselftest: mm: fix some failure of split_huge_page_test" (Yeoreum Yun): Fix huge-page split tests racing with khugepaged recollapse. Use pagemap and page flags instead of VMA-boundary assumptions which fail when glibc has already enabled THP. - "memcg: move memcgid refcount to objcg to unpin dying memcgs" (Bingfang Guo): Let dying memcgs be freed while swapped-out shmem still holds their IDs. Move ID references to reparentable objcgs, with the necessary swap accounting and RCU lifetime changes. - "mm/truncate: fix data loss when truncating straddling large folios" (Zhang Yi): Preserve out-of-range data when truncating straddling large folios. Fix a lookup race and split-failure handling, and handle minimum folio orders for the forthcoming ext4 iomap buffered I/O path. - "mm/damon: introduce damos quota goal target metric complement flag" (SJ Park): Let DAMOS quota goals use a metric's complement, so utilization can also express free-memory goals without adding separate metrics. Add the sysfs interface, documentation and tests. - "arm64/mm: Standardize printing for pgtable entries" (Anshuman Khandual): Use the generic formatter for arm64 page-table entries, ready for future wider entries. Move the safe-PTE-update check out of the header to avoid an include cycle. - "mm: kmsan: fix iounmap metadata teardown" (Dima Koziuk): Fix KMSAN metadata leaks on iounmap and failed ioremap allocations. Free backing pages before removing their mappings, and share the teardown with partial-allocation cleanup. - "mm/damon/core: preserve quota state when constructing schemes" (Karl Mehltretter): Preserve running DAMOS quota state while validating parameter updates. Even rejected updates could reset accounting and exceed the quota window; add tests for both accepted and rejected updates. - "mm/vmalloc: fix vmalloc_dump_obj VA lookup" (Ye Liu): Fix vmalloc_dump_obj() lookups for last-page addresses and allocations spanning vmap zones. These allocations were being missed in diagnostic output. - "mm: various (urgent?) fixes" (David Hildenbrand): Fix mmap charge leaks and hugetlb use-after-free, wrong-address unmapping, stuck locks and endless faults. Also preserve reservations on failed mremap and handle stale userfaultfd bits. - "maple_tree: fix maple_range_64 crashes in RCU mode" (Dimitris Charisis): Fix pointer and metadata confusion during RCU destruction of maple_range_64 nodes, avoiding double frees and invalid accesses. Add a regression test; no in-tree user currently uses this combination. - "mm: fix hugetlb NR_HUGETLB accounting on folio migration" (Hongfu Li): Fix hugetlb migration and preallocation accounting so /proc/vmstat retains the correct count and memory.numa_stat follows the folio to its new node. - "mm/damon: fix a minor bug, clean code, and add a test" (SJ Park): Fix 32-bit DAMON age overflow which made old regions look young. Share hugetlb folio acquisition code and add a regression test for the previously fixed last-region skipping bug. - "mm/damon/core: cleanup code, reduce stack usage, and add kunit" (SJ Park): Reduce kdamond stack usage and remove unused enums. Add deterministic PSI quota-goal tests which do not depend on the machine's current memory pressure. - "mm/damon: fix the temporal goal tuner's size quota conversion" (Donggeun Yoo): Bound the temporal tuner's quota conversion to prevent overflow and zero effective quotas, which could stop schemes making progress. Add boundary tests. - "Don't use GFP_DMA when calling dma_alloc_coherent" (Baoquan He): Remove redundant GFP_DMA flags from coherent DMA allocation calls. The DMA API already selects the zone from device limits and ignores the caller's flag. - "kselftest: mm: fix intermittent failure khugepaged test" (Yeoreum Yun): Propagate child-process failures in the khugepaged tests and prevent background collapse from racing their checks. This removes false passes and intermittent failures. - "MAINTAINERS: cover all hugetlb headers under HUGETLB SUBSYSTEM" (Enze Li): Cover all hugetlb headers in MAINTAINERS so get_maintainer.pl finds the right maintainers. Also label the closing hugetlb_cgroup.h include guard. Summary of the 65 singletons in this merge: The singletons include a few worthwhile performance fixes. Avoiding unnecessary reverse-map tree updates gave a reported 15.9% improvement in UnixBench's execl test on a 192-core x86 system. A reclaim retry fix stops defrag_mode from spinning under memory.low protection; a reported file-creation stress test ran 5.7 times faster, with far less memory pressure. Narrower hugetlb invalidations also spare KVM guests needless refaults: the reported Redis-in-VM P99 QPS penalty while punching holes fell from 7.09% to 1.45%. Several fixes prevent lost data or corrupted memory. Lazyfree huge-page races with mremap()/munmap() could lose data or access freed memory, and MADV_COLD could lose a concurrent write's dirty bit. Another fix prevents stale migration entries from outliving large folios. On filesystems with blocks smaller than a page, extending a file by 4 GiB or more could expose bytes written past the old EOF through mmap instead of zeroes. That is fixed, along with use-after-free races in PAGEMAP_SCAN during process exit and in memory-cgroup accounting on PREEMPT_RT kernels. Other fixes stop UFFDIO_MOVE spinning forever on pinned large folios, which could wedge other memory operations, and stop mremap() leaking commit charges until allocations fail under strict overcommit. A further fix keeps userfaultfd tracking intact on neighboring mappings. NUMA binding no longer prevents long-term pins when the chosen node has only movable memory, fixing QEMU/VFIO startup and io_uring buffer registration failures. MGLRU also gets a fix for early-boot crashes with memory cgroups disabled at boot, notably in small crash kernels. * tag 'mm-stable-2026-10-25-19-27' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (213 commits) mm: multi-gen LRU: fix NULL lruvec->pgdat deref with memcg disabled on cmdline mm/page_counter: use WRITE_ONCE() for emin/elow when parent is the root mm/memcontrol: publish null pointer before dropping css reference test_maple_tree: test maple_range_64 node in RCU mode maple_tree: fix maple_range_64 crashes in RCU mode mm/vma: avoid broken uffd merge on mremap tools/testing/shared: catch a failed posix_memalign() mm/damon/core: remove unreachable damos charge_{target,addr}_from mm/shrinker: allocate shrinker_info_unit from a dedicated kmem_cache riscv: mm: exclude invalid THP PMDs from page table check mm/damon/core: filter out damos address filter-split failed region fs/proc/task_mmu: pin mm_users in do_pagemap_scan() mm/mempolicy: apply bind policies against the scoped allocation zone mm/vmscan: reclaim every zone in per-node proactive reclaim mm/mremap: correctly uncharge accountable VMAs in error path mm/mremap: populate calculated fields in vrm state correctly MAINTAINERS: add an entry for MEMORY MANAGEMENT - MEMORY MAP mm: bdi: reset min_ratio after the sysfs attributes are gone mm/page_vma_mapped: continue past nonmatching huge PMDs selftests/mm: skip hugetlb cgroup v2 tests without the needed controllers ...
7 daysspi: cs42l43: Add speaker ID quirk for Dell XPS 13 DX13260 SKU 0E54Jérémie Rodon
The Dell XPS 13 DX13260 is also sold with SKU 0E54, which has the same ACPI speaker ID layout as SKU 0E53: two pins in one GpioIo() while the spk-id-gpios _DSD property references only the first. Without the quirk the speaker ID is wrong (0), so there is no speaker audio and no amp firmware is loaded. Add a DMI entry for SKU 0E54 using the same handler. Fixes: cad16d850e37 ("spi: cs42l43: Workaround for wrong speaker ID on Dell XPS 13 DX13260") Signed-off-by: Jérémie Rodon <jeremie.rodon@gmail.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20261025095037.18891-1-jeremie.rodon@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
9 daysspi: atmel: don't use GFP_DMA when calling dma_alloc_coherent()Baoquan He
dma_alloc_coherent() allocates the DMA buffer with the device's addressing limitation in mind; the DMA core picks the zone from the device's coherent DMA mask and ignores GFP_DMA passed by the caller. Remove the redundant GFP_DMA flag. Link: https://lore.kernel.org/20260903111836.1777265-10-hebaoquan@kylinos.cn Signed-off-by: Baoquan He <hebaoquan@kylinos.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Harry Yoo <harry@kernel.org>
9 daysspi: spi-ti-qspi: don't use GFP_DMA when calling dma_alloc_coherent()Baoquan He
dma_alloc_coherent() allocates the DMA buffer with the device's addressing limitation in mind; the DMA core picks the zone from the device's coherent DMA mask and ignores GFP_DMA passed by the caller. Remove the redundant GFP_DMA flag. Link: https://lore.kernel.org/20260903111836.1777265-5-hebaoquan@kylinos.cn Signed-off-by: Baoquan He <hebaoquan@kylinos.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Harry Yoo <harry@kernel.org>
10 daysspi: zynq-qspi: fix address buffer corruption and support 4-byte addressPufan Jin
In zynq_qspi_exec_mem_op(), when transmitting address bytes, the driver iterates over op->addr.nbytes and populates xqspi->txbuf[i]. However, xqspi->txbuf is never re-assigned before populating the address, meaning it still points to (u8 *)&op->cmd.opcode from the command phase. This causes two severe issues: 1. Memory corruption: Writing into xqspi->txbuf writes past the opcode buffer on the stack (which was passed as const struct spi_mem_op *). If opcode is zero, xqspi->txbuf is uninitialized. 2. In zynq_qspi_supports_op(), operations with op->addr.nbytes > 3 are rejected. When paired with SPI NOR flashes larger than 16MB (such as Winbond W25Q256), spi_nor_spimem_check_read_pp_op() tests 4-byte address support, which fails and causes spi_nor_select_read() to drop all read capabilities, failing probe with -EINVAL (-22). The Zynq-7000 QSPI controller hardware in manual I/O mode natively supports transmitting 1 to 4 address bytes via its TXD FIFO registers (ZYNQ_QSPI_TXD_00_00_OFFSET). Fix this by introducing a local opaddr[4] buffer in zynq_qspi_exec_mem_op() and explicitly setting xqspi->txbuf = opaddr before populating address bytes. Also allow up to 4 address bytes in zynq_qspi_supports_op(). Fixes: 67dca5e580f1 ("spi: spi-mem: Add support for Zynq QSPI controller") Cc: stable@vger.kernel.org Signed-off-by: Pufan Jin <cyan2254650260@gmail.com> Link: https://patch.msgid.link/20261016130812.282624-1-cyan2254650260@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
14 daysspi: Merge up fixesMark Brown
A small collection of driver specific fixes, all quite important if you have the relevant hardware.
2026-10-18spi: ch341: handle transfers without a TX or RX bufferWeibin Liu
ch341_transfer_one() unconditionally copies from trans->tx_buf into the TX packet and hands trans->rx_buf to usb_bulk_msg() for the readback. The SPI core allows half-duplex transfers where either of the buffers is NULL, so a transfer without TX data crashes the kernel on the memcpy and a transfer without RX data makes usb_bulk_msg() store the received data at address 0. The CH341A clocks data in both directions on every transfer; there is no mode to disable a direction. Set SPI_CONTROLLER_MUST_TX and SPI_CONTROLLER_MUST_RX so the SPI core fills in dummy buffers for half-duplex transfers. Fixes: 8846739f52af ("spi: add ch341a usb2spi driver") Cc: stable@vger.kernel.org # 6.11+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261013054339.77477-1-liuwb@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-16spi: spi-pci1xxxx: quiesce DMA engines on transfer timeoutWeibin Liu
If a DMA-mapped transfer times out waiting for DMA_TERM and neither DMA abort interrupt arrived, pci1xxxx_spi_transfer_with_dma() returns through the error label while both DMA engines are still enabled, the done/abort interrupt status is still armed and the transfer state (p->xfer, p->tx_sgl, p->rx_sgl) is still registered. The ISRs keep firing afterwards: they reprogram the DMA engines from p->tx_sgl / p->rx_sgl and signal completion through p->xfer and p->spi_xfer_done, all of which the SPI core is free to unmap or reuse once transfer_one() has returned, which is a use-after-free. A late done interrupt can also start the next transfer queued behind the failed one. Stop both DMA engines, drain the pending done/abort interrupt status and synchronize the DMA IRQs before dropping the in-progress state and the transfer pointers, and re-enable the engines afterwards so that subsequent transfers keep working. The engines are only turned back on once both were confirmed to have stopped: re-enabling an engine that failed to stop would cancel the pending stop request and let it keep running into buffers the SPI core is about to unmap or free, which is exactly the window this patch closes. An engine that failed to stop is left disabled, as the abort paths already do. The DMA interrupt status and mask registers are shared between the two SPI instances, so the cleanup drains only this instance's done/abort status bits instead of masking the interrupt lines, which would also suppress the peer instance's completion interrupts. Also make the DMA ISRs ignore interrupts while no transfer is in progress so that a stray MSI after the cleanup can no longer act on the cleared state. No PCI1XXXX hardware was available for testing and QEMU has no model of this PCIe part, so the timeout path was exercised with a userspace replica of the timeout branch and the DMA ISRs, with the register and interrupt accesses mocked: on the unfixed code both a wedged engine that clears after the timeout and a late done interrupt touch the freed transfer state, while with this fix applied neither does and an engine that failed to stop is left disabled. The module was also loaded and unloaded in a QEMU x86_64 guest running a kernel with this fix applied. Fixes: 9538edeb72c9 ("spi: mchp-pci1xxxx: DMA support for copying data to and from SPI Buf") Cc: stable@vger.kernel.org # 6.8+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261016020036.1333548-1-liuwb@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: amd: fix len==0 underflow and FIFO overflowWeibin Liu
amd_spi_fifo_xfer() unconditionally decrements xfer->len when a tx_buf is present. The SPI core does not reject zero-length transfers, so a transfer submitted through the SPI_IOC_MESSAGE ioctl with len == 0 and a tx_buf makes the u32 len wrap to 0xFFFFFFFF, and the following per-byte loop writes far past the FIFO window. The driver also never checks the cumulative FIFO offset against AMD_SPI_FIFO_SIZE. The core splits each transfer down to the controller's max transfer size but does not bound the total message length, so a message of several transfers whose total exceeds the FIFO overflows it with out-of-bounds MMIO writes (tx) and reads (rx). Skip zero-length transfers and reject any transfer that would run past the end of the FIFO window. Tested with a user-space replica of the fifo_xfer length arithmetic (ASAN build): a zero-length transfer with tx_buf makes len-- wrap to 0xffffffff, and skipping zero-length transfers avoids the wrap. No AMD SPI hardware was available, so the FIFO bound check was verified by inspection against AMD_SPI_FIFO_SIZE. Fixes: bbb336f39efc ("spi: spi-amd: Add AMD SPI controller driver support") Cc: stable@vger.kernel.org # 5.8+ Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com> Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261014-spi-amd-fifo-fix-v1-1-9fec9ab753e8@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: tegra114: initialize native chip selects inactiveAbraham Zukor
tegra_spi_probe() initializes SPI_COMMAND1 with only SPI_M_S, leaving CS_POL_INACTIVE clear for every chip select. This drives every native active-low chip select low until tegra_spi_setup() runs for that device. SPI children are registered and probed one at a time. A synchronous probe of an earlier child can therefore transfer while a later child's chip select is still asserted. On a Tegra234 system with active-low devices on CS0 and CS1, this caused both devices to be selected when the CS1 device probed first. Its initialization then intermittently failed. A logic analyzer showed CS0 remained low throughout the CS1 transfer and went high only after the CS1 probe failed. Walk the controller's device tree children before SPI_COMMAND1 is written and set CS_POL_INACTIVE for each valid chip select without spi-cs-high. That way the line is already deasserted when the first child transfers and does not change level when setup runs. Disabled children are walked too. The core only registers available children, so tegra_spi_setup() never runs for a disabled one and probe is the only chance to park its chip select at the level its hardware needs. If an enabled child shares a chip select with disabled ones, its polarity takes priority. If only disabled children use a chip select and they disagree, warn and leave the line inactive high. Fixes: f333a331adfa ("spi/tegra114: add spi driver") Assisted-by: Claude:Opus-5 Signed-off-by: Abraham Zukor <abe@maticrobots.com> Link: https://patch.msgid.link/20261010195503.623287-1-abe@maticrobots.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: spi-fsl-lpspi: directly return ret in fsl_lpspi_transfer_one()Marc Kleine-Budde
Both fsl_lpspi_dma_transfer() and fsl_lpspi_pio_transfer() only return negative error values in case of error or 0 in case of success. Directly return ret, there is no need to check for positive error values and return them as 0. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Link: https://patch.msgid.link/20261009-spi-fsl-lpspi-more-cleanups-v1-2-2d4549d5205e@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: spi-fsl-lpspi: pass struct fsl_lpspi_data instead of struct ↵Marc Kleine-Budde
spi_controller if possible Instead of passing a spi_controller pointer to functions and using spi_controller_get_devdata() to get the struct fsl_lpspi_data pointer, directly pass a struct fsl_lpspi_data pointer. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20261009-spi-fsl-lpspi-more-cleanups-v1-1-2d4549d5205e@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: imx: fix slab corruption from undersized DMA bounce buffersRichard Leitner
Since commit faa8e404ad8e ("spi: imx: support dynamic burst length for ECSPI DMA mode"), the driver allocates its private DMA TX/RX buffers with kzalloc(dma_len), where dma_len is only rounded up to 4 bytes, but maps, syncs and unmaps them with DMA_CACHE_ALIGNED_LEN(dma_len), i.e. rounded up to the cache line size. As a result, the DMA API operates on memory beyond the end of the allocation. This was observed on a custom i.MX8MP platform with an mcp251xfd CAN controller under heavy RPMSG load, as a series of refcount_t warnings triggered from rpmsg_recv_done() in virtio_rpmsg_bus: refcount_t: addition on 0; use-after-free. refcount_t: underflow; use-after-free. refcount_t: saturated; leaking memory. Leading finally to an "Unable to handle kernel paging request" oops. Reproducing this problem took between 30 minutes and roughly 30 hours under the same workload. Hardware watchpoints on the refcount of a struct rpmsg_endpoint showed it was overwritten from 2 to 1 by __pi_memcpy_generic() in the irq/155-spi2.0 thread. Additionally it was found that a "normal" rpmsg_recv_done() took 11µs +/-2µs from its kref_get to kref_put. In the error case the same sequence took about 215µs +/-10µs. Based on this, an LLM was used to identify the size mismatch fixed here. Allocate the buffers with DMA_CACHE_ALIGNED_LEN(dma_len) so they cover the full mapped length, and use the same length for dma_sync_single_for_cpu() to stay consistent with map and unmap. With this patch applied, the same workload ran for more than 200 hours without the problem reproducing. Assisted-by: LLM Fixes: faa8e404ad8e ("spi: imx: support dynamic burst length for ECSPI DMA mode") Cc: stable@vger.kernel.org Signed-off-by: Richard Leitner <richard.leitner@linux.dev> Link: https://patch.msgid.link/20261015-fix-spi-imx-dma-v1-1-e28259671392@linux.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: bcm-qspi: reject oversized dummy bytes in mspi exec_mem_opWeibin Liu
bcm_qspi_mspi_exec_mem_op() builds a local command buffer cmd[6] holding one opcode byte, up to four address bytes and one spare byte, and sets t[0].len = op->addr.nbytes + op->dummy.nbytes + 1. bcm_qspi_exec_mem_op() only validates op->addr.nbytes <= 4 and never bounds op->dummy.nbytes, which spi_mem_check_op() also leaves unrestricted. With addr.nbytes = 4 and dummy.nbytes >= 2 the length becomes 7 or more, so write_to_hw() reads past cmd[] on the kernel stack and pushes the leaked bytes into the hardware TXRAM. Reject operations whose dummy phase does not fit the remaining byte of cmd[] by requiring op->dummy.nbytes <= 1, so such transfers fall back to the generic SPI path instead of overrunning the buffer. Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com> Fixes: 5f195ee7d830c ("spi: bcm-qspi: Implement the spi_mem interface") Cc: stable@vger.kernel.org # 4.18+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261015-bcm-qspi-dummy-bytes-v1-1-c319da3c2497@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: npcm-fiu: limit UMA data_size to the 16-byte staging bufferWeibin Liu
npcm_fiu_uma_read() and npcm_fiu_uma_write() use a 16-byte on-stack staging buffer (u32 data_reg[4]) and move data_size bytes to or from it. data_size comes straight from op->data.nbytes, which is supplied by the SPI MEM operation and is not bounded by the driver: npcm_fiu_exec_op() only validates op->addr.nbytes, and no adjust_op_size callback truncates the transfer to the controller FIFO size. A SPI MEM operation with addr.nbytes == 0 and data.nbytes > 16 therefore overflows data_reg[] on the kernel stack (write path) or reads past it (read path), corrupting the stack. Reject data_size larger than the staging buffer in both UMA helpers by returning -EOPNOTSUPP, so spi_mem falls back to the generic SPI message path. The chunked path in npcm_fiu_manualwrite() always passes at most CHUNK_SIZE bytes, so it is unaffected. Fixes: ace55c411b11 ("spi: npcm-fiu: add NPCM FIU controller driver") Cc: stable@vger.kernel.org # 5.4+ Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com> Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261015-npcm-fiu-uma-datasize-v1-1-7dee91cadee6@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: omap2-mcspi: handle DMA setup failuresSahaj Chaudhari
The DMA paths ignore failures from dmaengine_slave_config(), descriptor preparation and dmaengine_submit(), and carry FIXME comments about falling back to PIO. A failed setup can leave a half-started transfer or wait for a completion that never arrives. Check each step and clean up with dmaengine_terminate_sync() on error. Prepare both descriptors before issuing either channel. Fall back to PIO only for host-mode transfers that have a TX buffer, when no DMA has been started and cleanup succeeded. RX-only and target-mode transfers return the error instead, since the bus may already be clocking. The FIFO is enabled before the DMA attempt, but the PIO path polls per-word TXS/RXS and does not expect FIFO mode. Disable the FIFO, with the channel off while its bits change, before falling back. Tested on an AM642 board with a TI 6.12.57 vendor kernel built with this patch and booted from RAM. On a McSPI bus using DMA, 200 iterations of 4096-byte TX and 1024-byte RX spidev transfers completed with no errors, timeouts or kernel warnings. With a temporary change that fails every DMA-sized TX setup, 60 spidev writes fell back to PIO with no errors or timeouts. That test used a bus with no device attached and did not show a difference with and without the FIFO disable, which is based on reading the code. Fixes: 53741ed8f0a3 ("spi: omap2-mcspi: add DMA engine support") Link: https://lore.kernel.org/r/20250914022132.319227-1-alex.t.tran@gmail.com Signed-off-by: Sahaj Chaudhari <sahaj123.sc@gmail.com> Link: https://patch.msgid.link/20261015064341.1100422-1-sahaj123.sc@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-15spi: jcore: fix divide-by-zero when speed_hz is zeroWeibin Liu
jcore_spi_baudrate() computes hw->clock_freq / 2 / speed without validating speed. The SPI core fills transfer.speed_hz from spi->max_speed_hz when it is zero, and jcore_spi_probe() never sets host->max_speed_hz, so the clamp in __spi_setup() is skipped. A spi_device created via the sysfs new_device interface (or a DT node without spi-max-frequency) therefore has max_speed_hz == 0, and any SPI_IOC_MESSAGE transfer reaches jcore_spi_baudrate() with speed == 0, causing a division by zero and a kernel panic. Clamp speed to a minimum of 1 Hz before the division so the divisor is never zero. The computed divider then truncates to the register field width and the transfer simply runs at the slowest supported rate. Verified by inspection of the __spi_setup() clamp and __spi_validate()'s speed_hz handling; the division-by-zero path requires the J-Core controller, which was not available. Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com> Fixes: 2cb1b3b3ac0a ("spi: add driver for J-Core SPI controller") Cc: stable@vger.kernel.org # 4.9+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261014-spi-jcore-divzero-v1-1-a8205d30f2d1@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-14spi: cadence-xspi: two memory-safety fixes in the slave-DMA pathsMark Brown
Weibin Liu <liuwb@xiaopeng.com> says: While reviewing the slave-DMA handling of the Cadence XSPI driver I found two ways in which memory the SPI core handed to the driver can be overrun: 1/2 both SDMA handlers copy the byte count reported by SDMA_SIZE_REG without checking it against the requested transfer length; a device reporting more bytes than were programmed makes the handlers walk past the end of the transfer buffers 2/2 the Marvell b0 transfer path points the SDMA buffers at a 10-byte stack scratch area for transfers without TX data; transfers longer than that overflow it in both directions and clock out uninitialized stack bytes to the attached device The two patches are independent of each other and each carries its own Fixes: tag, so they can be queued separately. Tested on x86_64: with both patches applied the driver builds, loads and unloads cleanly; no xSPI controller is available in this environment to exercise the slave-DMA paths on hardware. Details are in the notes of the individual patches. Link: https://patch.msgid.link/20260929081146.41041-1-liuwb@xiaopeng.com
2026-10-14spi: cadence-xspi: fix stack buffer overflow in the Marvell b0 pathWeibin Liu
transfer_one_message_b0() falls back to a 10-byte stack buffer for transfers which carry no TX data and points both in_buffer and out_buffer into it. With a transfer longer than 10 bytes the SDMA branch of the loop moves up to MRVL_XFER_QWORD_COUNT * MRVL_XFER_QWORD_BYTECOUNT (256) bytes through those pointers and then advances them by the same amount, so both directions overflow the scratch buffer: a read transaction copies SDMA data past the end of the buffer, a write transaction sends stack contents from beyond it to the SPI bus. Size the scratch buffer for the largest chunk the loop can request, keep the buffer pointers pinned to it when the message does not carry the corresponding TX or RX data, and only advance the pointers which reference real transfer buffers. Also zero-initialize the scratch buffer so that padding bytes sent for TX-less transfers no longer leak uninitialized stack contents. Fixes: 5cb7651f78e1 ("Marvell HW overlay support for Cadence xSPI") Cc: stable@vger.kernel.org # 6.11+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20260929081146.41041-3-liuwb@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-14spi: cadence-xspi: reject SDMA transfers larger than the requested lengthWeibin Liu
The XSPI controller reports the size of the slave-DMA transaction through SDMA_SIZE_REG. Both SDMA handlers take this register at face value and copy the reported number of bytes between the SDMA FIFO and the transfer buffers, without checking it against the length of the transfer that was actually requested. While cdns_xspi_adjust_mem_op_size() clamps the size of the operations issued by the SPI core, the device can still report a bigger SDMA size than what was programmed, which makes the handlers read from or write to memory beyond the end of the transfer buffers. Track the number of bytes requested for the current data phase in a new sdma_xfer_len field, set by cdns_xspi_send_stig_command() and by the Marvell b0 transfer path, and reject any SDMA size that exceeds it. Fixes: a16cc8077627 ("spi: cadence: add support for Cadence XSPI controller") Cc: stable@vger.kernel.org # 5.16+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20260929081146.41041-2-liuwb@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: tegra114: assert CS GPIO for every transfer in a messageCarlos Jones Jr
The driver provides its own transfer_one_message() and therefore drives the chip-select GPIO itself rather than through the SPI core. The GPIO is asserted only in the is_first_of_msg path of tegra_spi_setup_transfer_one(), but tegra_spi_transfer_end() deasserts it whenever a transfer has cs_change set. For a multi-transfer message whose earlier transfers request cs_change -- for example a register read that sends the address in one transfer and clocks the data back in the next -- the CS GPIO is released after the first transfer and never re-asserted, so the remaining transfers are clocked with chip-select inactive and the peripheral never drives the bus. This was observed with an ADIS16470 IMU (adis16475 driver), whose register read is a two-transfer, cs_change-framed exchange: a logic analyzer showed the data frame clocked with CS high, and the driver read 0 while the device drove 0x4056 on the wire. Re-assert the CS GPIO for every transfer so that multi-transfer messages keep chip-select active across the whole message. gpiod_set_value() is idempotent and polarity-aware, so this is a no-op for the first transfer and for messages that keep CS asserted throughout. Fixes: 63c1440596ff ("spi: tegra114: add support for gpio based CS") Signed-off-by: Carlos Jones Jr <carlosjr.jones@analog.com> Link: https://patch.msgid.link/20261002085540.1625-1-carlosjr.jones@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: meson-spicc: fix invalid DMA unmap on mapping failureHongjian Dai
meson_spicc_dma_unmap() decided whether a buffer had to be unmapped by testing its DMA address for non-zero. On a mapping failure dma_map_single() returns DMA_MAPPING_ERROR (typically non-zero), so the error path in meson_spicc_transfer_one() passed that error value to dma_unmap_single(), unmapping an address which was never mapped. The same happened for t->rx_dma on TX mapping failure, which is not written at all. Initialize both addresses to DMA_MAPPING_ERROR before mapping and use dma_mapping_error() to decide, so only buffers which were actually mapped are unmapped. Fixes: 18197e98353d ("spi: meson-spicc: add DMA support") Signed-off-by: Hongjian Dai <daihongjian@kylinsec.com.cn> Link: https://patch.msgid.link/35143466F2F5166F+20261008124704.87708-1-daihongjian@kylinsec.com.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: replace strcpy(), sprintf() and simple_strtoul() with strscpy(), ↵Mark Brown
snprintf() and kstrtoul() Aayush Kumar <code@aayushk.dev> says: Replace strcpy(), sprintf() and simple_strtoul() with their safer modern equivalents (strscpy, snprintf, kstrtoul). Link: https://patch.msgid.link/20261009133609.579046-1-code@aayushk.dev
2026-10-13spi: s3c64xx: Use snprintf() instead of sprintf()Aayush Kumar
Use snprintf() instead of sprintf() to avoid potential buffer overflows when formatting the clock name. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133609.579046-6-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: omap2-mcspi: Use snprintf() instead of sprintf()Aayush Kumar
Use snprintf() instead of sprintf() to avoid potential buffer overflows when formatting DMA channel names. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133609.579046-5-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: tle62x0: Use kstrtoul() instead of simple_strtoul()Aayush Kumar
Use the recommended kstrtoul() instead of the deprecated simple_strtoul(). Check the return value and reject invalid values. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133609.579046-4-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: lm70llp: Use strscpy() instead of strcpy()Aayush Kumar
Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133609.579046-3-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: butterfly: Use strscpy() instead of strcpy()Aayush Kumar
Use a safer function strscpy() instead of strcpy() for copying to arrays. Only idiomatic code replacement, and no functional changes. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133609.579046-2-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: use devm_platform_ioremap_resource() in sh-hspi and jcoreMark Brown
Aayush Kumar <code@aayushk.dev> says: Convert these two SPI drivers to the devm_platform_ioremap_resource() helper to simplify the probe paths. Link: https://patch.msgid.link/20261009132421.557758-1-code@aayushk.dev
2026-10-13spi: jcore: Use devm_platform_ioremap_resource()Aayush Kumar
Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource(), devm_request_mem_region() and devm_ioremap() separately. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009132421.557758-3-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: sh-hspi: Use devm_platform_ioremap_resource()Aayush Kumar
Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap() separately. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009132421.557758-2-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: ljca: validate the response length before copying the dataWeibin Liu
ljca_spi_read_write() only checks that the response from the adapter carries the packet header and a non-zero payload length before copying r_packet->len bytes from the response into the transfer buffer. The payload length is taken from the packet the device sent back and is neither bounded by the number of bytes actually received nor by the size of the requested transfer: a misbehaving adapter can announce a payload larger than what it actually sent, and the memcpy then reads past the end of the 60-byte input buffer and writes past the end of the caller's transfer buffer. Check that the response carries the full header before reading r_packet->len, then reject responses whose payload is not contained in the data received or is longer than the requested transfer. Fixes: caee8e38da67 ("spi: Add support for Intel LJCA USB SPI driver") Cc: stable@vger.kernel.org # 6.8+ Signed-off-by: Weibin Liu <liuwb@xiaopeng.com> Link: https://patch.msgid.link/20261013031717.3933277-1-liuwb@xiaopeng.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: cadence-qspi: Prevent SPI NAND continuous readsMiquel Raynal
TI AM62Ax errata i2351, entitled "OSPI: Direct Access Controller (DAC) does not support Continuous Read mode with NAND Flash", explains that the CS can be deasserted almost at any time during a transfer (basically there is an interconnect arbitration every 1023 byte). This is an expected internal behaviour of the controller, but this leads to spurious CS deasserts. These are totally forbidden during SPI NAND continuous read transfers, because they indicate an end of transfer and the continuous read is then stopped on the flash side. I initially tried to query the flash type and geometry to decide whether to apply a spi message size limit (there is a spi helper for that) but we cannot reliably get up to the MTD structure to discriminate if it is a NOR or a NAND we are playing with (it is not relevant to limit SPI NOR transfers, they are not affected). If we actually take this path, what limitation shall we enforce? The errata mentions 1023B, this is super low, less than a typical page size (about 2k or 4k, for most of them), so this is not usable. On my side, I only observed this problem on a 2-page read in octal DTR mode with more than 12 dummy cycles. The writesize summed with the oobsize could be a relevant boundary, but it is still quite arbitrary. Hence, I opted for implementing a controller capability flag, which then is used to decide whether the SPI NAND continuous read feature can be enabled. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://patch.msgid.link/20261001-winbond-v7-0-rc1-cadence-cont-read-v2-1-703e040b2d07@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: axi-spi-engine: fix stale SYNC IRQ pendingMark Brown
Jonathan Santos <Jonathan.Santos@analog.com> says: Both spi_engine_setup() and spi_engine_trigger_enable() send a SYNC(1) command and poll SYNC_ID, but never clear INT_PENDING[SYNC] afterward. This leaves a stale pending bit that fires spuriously when INT_SYNC is enabled later by some driver, causing premature transfer completion at low SPI clock frequencies (more likely). Fix both functions by clearing the pending bit after polling. Link: https://patch.msgid.link/cover.1791361360.git.Jonathan.Santos@analog.com
2026-10-13spi: axi-spi-engine: fix stale SYNC IRQ pending in trigger_enableJonathan Santos
spi_engine_trigger_enable() sends SYNC(1) and polls SYNC_ID, it never clears the INT_PENDING[SYNC] bit afterward. This leaves a stale pending interrupt that can fire spuriously when INT_SYNC is later enabled. Simillarly to the fix on spi_engine_setup(), clear INT_PENDING[SYNC] after polling the SYNC_ID. Fixes: 8fc13b822c74 ("spi: axi-spi-engine: don't repeat mode config for offload") Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Link: https://patch.msgid.link/8d3f421e07b6114aae55f964825dba6ac9151cf5.1791361360.git.Jonathan.Santos@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: axi-spi-engine: fix stale SYNC IRQ pendingJonathan Santos
spi_engine_setup() sends a SYNC(1) command and polls SYNC_ID to confirm it was parsed by the FPGA, but never clears the corresponding interrupt pending bit (INT_PENDING[SYNC]). When the first real SPI transfer starts and INT_SYNC is enabled, that stale pending bit fires immediately, causing the IRQ handler to see the leftover SYNC_ID from setup, match it against the current transfer's ID, and prematurely signal completion before the hardware finishes. This race manifests at low SPI clock frequencies (~2-3 MHz), where the FPGA takes long enough to execute the transfer that handler is parsed before it finishes. At higher SCLK rates the transfer completes fast enough that the issue is masked. Fix this by clearing INT_PENDING[SYNC] after the polled SYNC, ensuring no stale interrupt is left pending. Reported-by: Dennis Heinzel <dennis.heinzel@irs.systems> Closes: https://ez.analog.com/linux-software-drivers/f/q-a/604145/axi-spi-engine-stale-sync-pending-can-complete-first-transfer-early-at-low-spi-clock-2-3-mhz Fixes: 1d0ee0c9df31 ("spi: axi-spi-engine: wait for completion in setup") Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Link: https://patch.msgid.link/d3033a01a695c915e4dc5952dfe0587b2f77d733.1791361360.git.Jonathan.Santos@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: dw: use threaded interruptMark Brown
Jisheng Zhang <jszhang@kernel.org> says: To avoid blocking for an excessive amount of time, eventually impacting on system responsiveness, hard interrupt handlers should finish executing in as little time as possible. Use threaded interrupt and move the SPI transfer handling to an interrupt thread when non-native CS and host only. After that, since the dw_reader() and dw_writer() are called in threaded ISR now, so we can delay the unmasking interrupts until no rx and tx action is taken, thus reduce the interrupt numbers further. Tested with below two cmds ./spidev_test -D /dev/spidev1.3 -s 30000000 -S 327680 -I 1 ./spidev_test -D /dev/spidev1.3 -s 30000000 -S 327680 -I 1000 ./rtla timerlat top -q -k -P f:95 The first cmd is to check the interrupt numbers optmizaion result, the 2nd cmd group is to check the threaded interrupt improvement. Before the patch: each 320KB spi spidev_test transfer triggers 33118 interrupts spidev_test reports ~22090 kbps and rtla reports: Timer Latency 0 00:00:37 | IRQ Timer Latency (us) | Thread Timer Latency (us) CPU COUNT | cur min avg max | cur min avg max 0 #9958 | 1 0 67 103394 | 6 4 2198 105031 1 #36902 | 1 0 1 18 | 5 4 5 29 After the patch: each 320KB spi spidev_test transfer only triggers 1 interrupts spidev_test reports ~23520 kbps and now rtla reports: Timer Latency 0 00:00:58 | IRQ Timer Latency (us) | Thread Timer Latency (us) CPU COUNT | cur min avg max | cur min avg max 0 #58362 | 1 0 0 29 | 6 3 4 56 1 #58363 | 1 0 1 23 | 6 4 5 68 In summary: before the patch after the patch 33118 interrutps 1 interrupts reduced by 33117 times! 103394 us max latency 29 us max latency reduced by 3564 times! 22090 kbps rate 23520 kbps rate improved by 6.5% Link: https://patch.msgid.link/20261005151739.25233-1-jszhang@kernel.org
2026-10-13spi: dw: use threaded interrupt and optimize the threaded ISRJisheng Zhang
To avoid blocking for an excessive amount of time, eventually impacting on system responsiveness, hard interrupt handlers should finish executing in as little time as possible. Use threaded interrupt and move the SPI transfer handling to an interrupt thread when non-native CS and host only. After that, since the dw_reader() and dw_writer() are called in threaded ISR now, so we can delay the unmasking interrupts until no rx and tx action is taken, thus reduce the interrupt numbers further. Tested with below two cmds ./spidev_test -D /dev/spidev1.3 -s 30000000 -S 327680 -I 1 ./spidev_test -D /dev/spidev1.3 -s 30000000 -S 327680 -I 1000 ./rtla timerlat top -q -k -P f:95 The first cmd is to check the interrupt numbers optmizaion result, the 2nd cmd group is to check the threaded interrupt improvement. Before the patch: each 320KB spi spidev_test transfer triggers 33118 interrupts spidev_test reports ~22090 kbps and rtla reports: Timer Latency 0 00:00:37 | IRQ Timer Latency (us) | Thread Timer Latency (us) CPU COUNT | cur min avg max | cur min avg max 0 #9958 | 1 0 67 103394 | 6 4 2198 105031 1 #36902 | 1 0 1 18 | 5 4 5 29 After the patch: each 320KB spi spidev_test transfer only triggers 1 interrupts spidev_test reports ~23520 kbps and now rtla reports: Timer Latency 0 00:00:58 | IRQ Timer Latency (us) | Thread Timer Latency (us) CPU COUNT | cur min avg max | cur min avg max 0 #58362 | 1 0 0 29 | 6 3 4 56 1 #58363 | 1 0 1 23 | 6 4 5 68 In summary: before the patch after the patch 33118 interrutps 1 interrupts reduced by 33117 times! 103394 us max latency 29 us max latency reduced by 3564 times! 22090 kbps rate 23520 kbps rate improved by 6.5% Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://patch.msgid.link/20261005151739.25233-5-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: dw: restore previous irq handling behavior when !ctlr->cur_msgJisheng Zhang
Recent "enhanced" support changes the dw_spi_irq() behavior a bit when !!ctlr->cur_msg: if (!ctlr->cur_msg && dws->transfer_handler == dw_spi_transfer_handler) { dw_spi_mask_intr(dws, 0xff); return IRQ_HANDLED; } But it misses the dma case, where the transfer_handler == dw_spi_dma_transfer_handler, so this changes the previous long time working behavior, let's restore the previous handling by only filtering out the dw_spi_enh_handler. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> Link: https://patch.msgid.link/20261005151739.25233-4-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: dw: remove duplicated "!rx_len && !tx_len" handling from dw_spi_irqJisheng Zhang
dw_spi_irq() need not handle enhanced-transfer's "!rx_len && !tx_len" case as that state is already handled by dw_spi_enh_handler() Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Changhuang Liang <changhuang.liang@starfivetech.com> Link: https://patch.msgid.link/20261005151739.25233-3-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: dw: remove useless dws->transfer_handler checkJisheng Zhang
transfer_handler is initialized before any DW SPI interrupt is unmasked. While the IRQ is registered but the handler is NULL, dw_spi_hw_init() has all DW SPI interrupts disabled. Therefore dw_spi_irq() cannot observe a DW SPI interrupt with a NULL transfer_handler. Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://patch.msgid.link/20261005151739.25233-2-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: spi-qpic-snand: skip BBM copy on regular raw readsGabor Juhos
Trying to read the raw flash contents with nanddump, the second byte of the OOB area contains 0xff instead of the real data in the flash. This happens because the qcom_spi_read_last_cw() function unconditionally copies the bad block marker into the second byte of the output buffer. Add a new flag to the controller's private data structure, and set it when only the first two bytes of the OOB area being read in raw mode. Also change the bad block copying code to run only when the flag is set. This ensures that the SPI NAND framework still can read the BBM bytes, but on regular raw read, the output does not contain the duplicated marker byte. Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface") Signed-off-by: Gabor Juhos <j4g8y7@gmail.com> Link: https://patch.msgid.link/20261005-qpic-snand-skip-bbm-copy-v1-1-04f6aeda4044@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: use kstrtoul() and snprintf()Mark Brown
Aayush Kumar <code@aayushk.dev> says: Replace simple_strtoul() with kstrtoul() and sprintf() with snprintf() in three SPI drivers. Link: https://patch.msgid.link/20261010083504.26261-1-code@aayushk.dev
2026-10-13spi: s3c64xx: Use snprintf() instead of sprintf()Aayush Kumar
Use snprintf() instead of sprintf() to avoid potential buffer overflows when formatting the clock name. Signed-off-by: Aayush Kumar <aayushkmx@gmail.com> Link: https://patch.msgid.link/20261010083504.26261-4-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: omap2-mcspi: Use snprintf() instead of sprintf()Aayush Kumar
Use snprintf() instead of sprintf() to avoid potential buffer overflows when formatting DMA channel names. Signed-off-by: Aayush Kumar <aayushkmx@gmail.com> Link: https://patch.msgid.link/20261010083504.26261-3-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-13spi: tle62x0: Use kstrtoul() instead of simple_strtoul()Aayush Kumar
Use the recommended kstrtoul() instead of the deprecated simple_strtoul(). Check the return value and reject invalid values. Signed-off-by: Aayush Kumar <aayushkmx@gmail.com> Link: https://patch.msgid.link/20261010083504.26261-2-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-12spi: use sysfs_emit() in bcm63xx-hsspi and bcmbca-hsspiMark Brown
Aayush Kumar <code@aayushk.dev> says: Convert the sysfs show() functions to use sysfs_emit() instead of sprintf(). Link: https://patch.msgid.link/20261009133631.579644-1-code@aayushk.dev
2026-10-12spi: bcmbca-hsspi: Use sysfs_emit() instead of sprintf()Aayush Kumar
show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133631.579644-3-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2026-10-12spi: bcm63xx-hsspi: Use sysfs_emit() instead of sprintf()Aayush Kumar
show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: Aayush Kumar <code@aayushk.dev> Link: https://patch.msgid.link/20261009133631.579644-2-code@aayushk.dev Signed-off-by: Mark Brown <broonie@kernel.org>