Re: [PATCH net] net: microchip: encx24j600: Avoid unsequenced accesses to jiffies in encx24j600_tx()
From: Andrew Lunn
Date: Sun Nov 15 2026 - 10:53:15 EST
On Sat, Nov 14, 2026 at 09:38:26PM -0700, Nathan Chancellor wrote:
> After a recent improvement in clang to warn on unsequenced accesses to
> volatile variables [1], an instance appears in encx24j600_tx(), which
> can break the build with CONFIG_WERROR=y / W=e:
>
> drivers/net/ethernet/microchip/encx24j600.c:898:14: error: unsequenced accesses to volatile qualified 'jiffies' [-Werror,-Wunsequenced]
> 898 | 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.
>
> Add a local variable to hold the value of jiffies before the function
> call so that there are no unsequenced side effects, clearing up the
> warning.
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 04fbfce7a222 ("net: Microchip encx24j600 driver")
> Closes: https://github.com/ClangBuiltLinux/linux/issues/2196
> Link: https://github.com/llvm/llvm-project/commit/955715460eaf9188c241c74750637fc82dfcc423 [1]
> Signed-off-by: Nathan Chancellor <nathan@xxxxxxxxxx>
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew