From: sashiko-bot@kernel.org
To: "Nuno Sá" <nuno.sa@analog.com>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH v3 8/9] spi: dw: Use dma_slave_caps bus width helpers
Date: Mon, 31 Aug 2026 12:08:31 +0000 [thread overview]
Message-ID: <20260831120831.C421F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831-dmaengine-support-wider-dma-masks-v3-8-507d97496f2d@analog.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] `dw_spi_can_dma()` evaluates DMA capability using stale `dws->n_bytes` state from a previous transfer, leading to invalid DMA configurations.
--
commit a1e1fa79562141ff2997ca919b2572914bd4eb82
Author: Nuno Sá <nuno.sa@analog.com>
spi: dw: Use dma_slave_caps bus width helpers
Store the common TX destination and RX source bus widths in a
driver-owned DMA bus width bitmap and populate it through the
dma_slave_caps helper.
> diff --git a/drivers/spi/spi-dw-dma.c b/drivers/spi/spi-dw-dma.c
> index fe726b9b1780d..bbd7ee884d0ec 100644
> --- a/drivers/spi/spi-dw-dma.c
> +++ b/drivers/spi/spi-dw-dma.c
[ ... ]
> @@ -253,7 +255,7 @@ static bool dw_spi_can_dma(struct spi_controller *ctlr,
>
> dma_bus_width = dw_spi_dma_convert_width(dws->n_bytes);
>
> - return dws->dma_addr_widths & BIT(dma_bus_width);
> + return dma_bus_width_test(dws->dma_bus_widths, dma_bus_width);
> }
[Severity: High]
This is a pre-existing issue, but does dw_spi_can_dma() evaluate DMA capability
using stale dws->n_bytes state from a previous transfer?
It appears spi_map_msg() invokes dw_spi_can_dma() before any transfer in the
message is executed. When dw_spi_can_dma() reads dws->n_bytes to determine the
DMA bus width, it gets the state from the last executed transfer.
The state is only updated later when the transfer actually starts:
drivers/spi/spi-dw-core.c:dw_spi_transfer_one() {
...
dws->n_bytes = spi_bpw_to_bytes(transfer->bits_per_word);
...
}
If a SPI message contains transfers with different bits_per_word, or if the
current message differs from the previous one, can_dma() might incorrectly
return true for a transfer that requires an unsupported DMA bus width. This
could lead to dmaengine_slave_config() failures or DMA hardware malfunctions
and data corruption.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831-dmaengine-support-wider-dma-masks-v3-0-507d97496f2d@analog.com?part=8
next prev parent reply other threads:[~2026-08-31 12:08 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 11:46 [PATCH v3 0/9] dmaengine: Support bus widths of 32 bytes and above Nuno Sá
2026-08-31 11:46 ` [PATCH v3 1/9] " Nuno Sá
2026-08-31 13:45 ` Andy Shevchenko
2026-08-31 15:56 ` Nuno Sá
2026-09-01 7:18 ` Andy Shevchenko
2026-08-31 11:46 ` [PATCH v3 2/9] dmaengine: dma-axi-dmac: Use bus width capability helpers Nuno Sá
2026-08-31 12:01 ` sashiko-bot
2026-08-31 12:27 ` nuno.sa
2026-08-31 11:46 ` [PATCH v3 3/9] dmaengine: dw-axi-dmac: " Nuno Sá
2026-08-31 11:58 ` sashiko-bot
2026-08-31 12:41 ` nuno.sa
2026-08-31 11:46 ` [PATCH v3 4/9] dmaengine: qcom: gpi: " Nuno Sá
2026-08-31 11:59 ` sashiko-bot
2026-08-31 11:46 ` [PATCH v3 5/9] dmaengine: stm32-dma3: " Nuno Sá
2026-08-31 14:01 ` Amelie Delaunay
2026-09-01 8:25 ` Nuno Sá
2026-08-31 11:46 ` [PATCH v3 6/9] iio: buffer-dmaengine: Use dma_slave_caps bus width accessors Nuno Sá
2026-08-31 11:46 ` [PATCH v3 7/9] ALSA: pcm_dmaengine: Use dma_slave_caps bus width helpers Nuno Sá
2026-08-31 11:46 ` [PATCH v3 8/9] spi: dw: " Nuno Sá
2026-08-31 12:08 ` sashiko-bot [this message]
2026-08-31 12:12 ` Mark Brown
2026-08-31 13:47 ` Andy Shevchenko
2026-08-31 11:46 ` [PATCH v3 9/9] dmaengine: Drop legacy bus width fields from dma_slave_caps Nuno Sá
2026-08-31 13:49 ` Andy Shevchenko
2026-08-31 13:50 ` [PATCH v3 0/9] dmaengine: Support bus widths of 32 bytes and above Andy Shevchenko
2026-08-31 15:51 ` Nuno Sá
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831120831.C421F1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox