Re: [PATCH v2 01/11] can: kvaser_usb: Add support to control CAN LEDs on device
From: Simon Horman <horms@kernel.org>
Date: 2025-07-26 19:48:17
Also in:
linux-can
From: Simon Horman <horms@kernel.org>
Date: 2025-07-26 19:48:17
Also in:
linux-can
On Fri, Jul 25, 2025 at 02:44:52PM +0200, Jimmy Assarsson wrote:
On 7/24/25 8:26 PM, Simon Horman wrote:quoted
On Thu, Jul 24, 2025 at 11:24:55AM +0200, Jimmy Assarsson wrote:
...
quoted
GCC seems to know that: * cmd was allocated sizeof(*cmd) = 32 bytes * struct kvaser_cmd_ext is larger than this (96 bytes) And it thinks that cmd->header.cmd_no might be CMD_EXTENDED. This is not true, becuae .cmd_no is set to CMD_LED_ACTION_REQ earlier in kvaser_usb_hydra_set_led. But still, GCC produces a big fat warning. On the one hand we might say this is a shortcoming in GCC, a position I agree with. But on the other hand, we might follow the pattern used elsewhere in this file for similar functions, which seems to make GCC happy, I guess, and it is strictly a guess, because less context is needed for it to analyse things correctly.Thanks for finding this! Marc Kleine-Budde actually sorted this out for other commands some years ago [1], but I had completely forgotten. [1] https://lore.kernel.org/all/20221219110104.1073881-1-mkl@pengutronix.de (local)
Nice, thanks for digging that up.