Re: [PATCH v2 4/4] spi: Add KUnit coverage for DMA mapping error paths
From: Andy Shevchenko
Date: Fri Aug 14 2026 - 08:27:27 EST
On Fri, Aug 14, 2026 at 11:14:18AM +0800, Honghui Jiang wrote:
> Add KUnit tests for the __spi_map_msg() error paths. The tests verify
> that a later TX or RX mapping failure clears the mapping state of
> earlier transfers and leaves cur_{tx,rx}_dma_dev identifying the
> current mapping device.
>
> A zero-length transfer causes sg_alloc_table() to return -EINVAL,
> providing deterministic failure injection without test hooks.
> Additional cases cover successful map/unmap and a message which
> requires no mapping.
>
> Build the DMA suite as a separate translation unit, exposing the two
> internal mapping helpers only for KUnit through the local internal
> header. Enable SPI in the default and all-tests KUnit configurations so
> the suite is exercised there.
...
> +++ b/tools/testing/kunit/configs/default.config
> @@ -1,3 +1,4 @@
> CONFIG_KUNIT=y
> CONFIG_KUNIT_EXAMPLE_TEST=y
> CONFIG_KUNIT_ALL_TESTS=y
> +CONFIG_SPI=y
This is a stray change.
--
With Best Regards,
Andy Shevchenko