Re: [PATCH iwl-next] ixgbe: use int instead of u32 for error code variables

Simon Horman
2026-04-03T13:41:39Z

On Fri, Mar 27, 2026 at 08:30:43AM +0100, Aleksandr Loktionov wrote:
> The variables used to store return values of kernel and driver functions
> throughout the ixgbe driver are declared as u32 in several places. Such
> functions return negative errno values on error (e.g. -EIO, -EFAULT),
> which are sign-extended negative integers. Storing them in an unsigned
> u32 silently wraps the value: -EIO (0xFFFFFFF7) stored in u32 becomes a
> large positive number, so any "if (status)" truthiness check still works
> by accident, but comparisons against specific negative error codes or
> propagation up the call stack would produce wrong results.
>
> In the Linux kernel, u32 is reserved for fixed-width quantities used in
> hardware interfaces or protocol structures. Using it for generic error
> codes misleads reviewers into thinking the value is hardware-constrained.
>
> Change all such local variables from u32 to int driver-wide: one in
> ixgbe_main.c (ixgbe_resume), three in ixgbe_phy.c
> (ixgbe_identify_phy_generic, ixgbe_tn_check_overtemp,
> ixgbe_set_copper_phy_power), and six in ixgbe_x550.c
> (ixgbe_check_link_t_X550em, ixgbe_get_lasi_ext_t_x550em,
> ixgbe_enable_lasi_ext_t_x550em, ixgbe_handle_lasi_ext_t_x550em,
> ixgbe_ext_phy_t_x550em_get_link, ixgbe_setup_internal_phy_t_x550em).
>
> No functional change.
>
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

Nice cleanup, thanks.

Reviewed-by: Simon Horman <horms@kernel.org>