qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
PATCH v2 1/1 qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
After a recent improvement in clang to warn on unsequenced accesses to volatile variables [1], an instance appears in qcaspi_netdev_tx_timeout(), which can break the build with CONFIG_WERROR=y / W=e:
drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
805 | jiffies, jiffies - dev_trans_start(dev));
| ~~~~~~~ ^Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11 6.5.2, unsequenced side effects on the same scalar object are undefined behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a function call is indeterminately sequenced, meaning any side effects in the arguments are unsequenced.
Printing jiffies on its own is not that useful for debugging transmit timeouts, so get rid of it to clear up the warning.
---
Changes in v2:
- Eliminate printing jiffies entirely rather than using a local variable
(Stefan)
- Link to v1: https://patch.msgid.link/[email protected]
--- drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/qca_spi.c +2 -2
@@ -801,8 +801,8 @@ qcaspi_netdev_tx_timeout(struct net_device *dev, unsigned int txqueue) {struct qcaspi *qca =netdev_priv (dev); -netdev_info (qca->net_dev,"Transmit timeout at %ld, latency %ld\n" , - jiffies, jiffies -dev_trans_start (dev)); +netdev_info (qca->net_dev,"Transmit timeout, latency %ld\n" , + jiffies -dev_trans_start (dev)); qca->net_dev->stats.tx_errors++;/* Trigger tx queue flush and QCA7000 reset */ set_bit (SPI_RESET , &qca->flags);
---
base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4
change-id: 20261114-qca_spi-wunsequenced-a81e54616844
Best regards,
Signature · 2 lines
Cheers, Nathan
Am 16.11.26 um 05:45 schrieb Nathan Chancellor:
Quoted 15 lines
After a recent improvement in clang to warn on unsequenced accesses to volatile variables [1], an instance appears in
qcaspi_netdev_tx_timeout(), which can break the build withCONFIG_WERROR=y/ W=e:drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced] 805 | jiffies, jiffies - dev_trans_start(dev)); | ~~~~~~~ ^Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11 6.5.2, unsequenced side effects on the same scalar object are undefined behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a function call is indeterminately sequenced, meaning any side effects in the arguments are unsequenced.
Quoted 8 lines
Printing jiffies on its own is not that useful for debugging transmit timeouts, so get rid of it to clear up the warning.
Fixes 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")Signed-off-by Nathan Chancellor <[email protected]>
Quoted 15 lines · Nathan Chancellor
After a recent improvement in clang to warn on unsequenced accesses to volatile variables [1], an instance appears in
qcaspi_netdev_tx_timeout(), which can break the build withCONFIG_WERROR=y/ W=e:
drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]805 | jiffies, jiffies - dev_trans_start(dev)); | ~~~~~~~ ^Per C11 5.1.2.3.2, accessing a volatile object is a side effect. Per C11 6.5.2, unsequenced side effects on the same scalar object are undefined behavior. Per C11 6.5.2.2.10/12, the evaluation of arguments in a function call is indeterminately sequenced, meaning any side effects in the arguments are unsequenced.
Quoted 6 lines
Printing jiffies on its own is not that useful for debugging transmit timeouts, so get rid of it to clear up the warning.
Fixes 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Just hit a handful of these last week; thanks for getting issues filed per (I thought it was just one instance; having one issue per makes its clearer this is flagging a few more cases. Thanks for sending fixes for these, too).
Quoted 2 lines
Quoted 34 lines
---
Changes in v2:
- Eliminate printing jiffies entirely rather than using a local variable
(Stefan)
- Link to v1: https://patch.msgid.link/[email protected]--- drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/ethernet/qualcomm/qca_spi.c +2
-3@@ -801,8 +801,8 @@ qcaspi_netdev_tx_timeout(struct net_device *dev, unsigned int txqueue) {struct qcaspi *qca =netdev_priv (dev); -netdev_info (qca->net_dev,"Transmit timeout at %ld, latency %ld\n" , - jiffies, jiffies -dev_trans_start (dev)); +netdev_info (qca->net_dev,"Transmit timeout, latency %ld\n" , + jiffies -dev_trans_start (dev)); qca->net_dev->stats.tx_errors++;/* Trigger tx queue flush and QCA7000 reset */ set_bit (SPI_RESET , &qca->flags); ---base-commit:
aa40afa831ebfe45e40a23721711059f2ac584d4
change-id: 20261114-qca_spi-wunsequenced-a81e54616844Best regards,
Signature · 2 lines
Cheers, Nathan
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Sun, 15 Nov 2026 21:45:22 -0700 you wrote:
After a recent improvement in clang to warn on unsequenced accesses to volatile variables [1], an instance appears in
qcaspi_netdev_tx_timeout(), which can break the build withCONFIG_WERROR=y/ W=e:
drivers/net/ethernet/qualcomm/qca_spi.c:805:16: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]805 | jiffies, jiffies - dev_trans_start(dev)); | ~~~~~~~ ^[...]
Here is the summary with links:
- [net,v2] qca_spi: Avoid unsequenced accesses to jiffies in qcaspi_netdev_tx_timeout()
https://git.kernel.org/netdev/net/c/695d0824cb6b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html