From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 469A32D2496 for ; Fri, 8 May 2026 03:12:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778209953; cv=none; b=Pht/4SsIkkpK6R8BYsSXMetIY0gCBgcW4e8Umk7A46d5wmlB6jgwkIrOEOLL7h2VsiJIbZB9CjEEXtfQu7H4Hh+5lJMpoZUSySw+APkiUK8vjAV+RoieSnH3kW+v3ErK++AoBNIo+do88FbdqXmGCtRDcyd73GdObcuyV9vm2Uw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778209953; c=relaxed/simple; bh=NDXYRNxohjaR9SlsX7zQsn4ljQYIO2z6Y5cD8SIerPU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yk/MphjGmy9WayFavH6fKP+3g+waGZHjQTBF3/tJ7OPUsiqO1PRGxAne5ktolTFsuIOCNC1Shf+jHg2lD7ph58tsNzPnhrAp4HK4v0HfjoJPIrvWkVmyLghFqf4+sT0oGfivU1RVgt0wYio/lT26nnFR2pNWVzHUzxN3NuYY4+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=f9BG9yfd; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="f9BG9yfd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778209952; x=1809745952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NDXYRNxohjaR9SlsX7zQsn4ljQYIO2z6Y5cD8SIerPU=; b=f9BG9yfd75PiKbCKMnDQrPqt1pqdrMf93D9T3wDhRiQ6KGjw7Bc+kREl c+CrzdFxivN0zNnXgS30vWIDLxn/bB+lr2hWT/Q+kdhv3+v6Ipn27u/re Cefs+zEnS0X+1zQ5IZ0fz1bqG3zC27AIrHToiGZCAdnS9+M2FNGkipi/p QjaUxZddh5Kja7GnzwXKx2KQ9zDiVM7dtwprvPoHlNd5OLxqREYy71lvA hkxyoqiUlegNhv234RSR8iLgK7DAyMI+oPS5EEawpSshngAWVIn5ZpYjO Y2OweeTMNbnjHr59SMpHjIEkpDzEVHZqxrOCJuP0qnR2+qfxmxWCvEZEP Q==; X-CSE-ConnectionGUID: 29oZBSQ4R1KU8bs1CrgsEg== X-CSE-MsgGUID: pmCCIEdoTgG6QImYtujF5g== X-IronPort-AV: E=McAfee;i="6800,10657,11779"; a="79027488" X-IronPort-AV: E=Sophos;i="6.23,222,1770624000"; d="scan'208";a="79027488" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2026 20:12:32 -0700 X-CSE-ConnectionGUID: MChumWXESnuwnG0zcO/pWw== X-CSE-MsgGUID: i7GdhBqkRKWzsz+joIaEFg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,222,1770624000"; d="scan'208";a="241623182" Received: from amlin-019-225.igk.intel.com ([10.102.19.225]) by fmviesa005.fm.intel.com with ESMTP; 07 May 2026 20:12:30 -0700 From: Aleksandr Loktionov To: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, aleksandr.loktionov@intel.com Cc: netdev@vger.kernel.org, Simon Horman Subject: [PATCH iwl-next 2/8] ixgbe: use int instead of u32 for error code variables Date: Fri, 8 May 2026 05:12:20 +0200 Message-ID: <20260508031226.3601800-3-aleksandr.loktionov@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260508031226.3601800-1-aleksandr.loktionov@intel.com> References: <20260508031226.3601800-1-aleksandr.loktionov@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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. Reviewed-by: Simon Horman Signed-off-by: Aleksandr Loktionov --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 2 +- drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 6 +++--- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 65426a1..b6308c1 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -7528,7 +7528,7 @@ static int ixgbe_resume(struct device *dev_d) struct pci_dev *pdev = to_pci_dev(dev_d); struct ixgbe_adapter *adapter = pci_get_drvdata(pdev); struct net_device *netdev = adapter->netdev; - u32 err; + int err; adapter->hw.hw_addr = adapter->io_addr; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index ab733e7..de8f6c6 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c @@ -262,7 +262,7 @@ static bool ixgbe_probe_phy(struct ixgbe_hw *hw, u16 phy_addr) **/ int ixgbe_identify_phy_generic(struct ixgbe_hw *hw) { - u32 status = -EFAULT; + int status = -EFAULT; u32 phy_addr; if (!hw->phy.phy_semaphore_mask) { @@ -2811,7 +2811,7 @@ static void ixgbe_i2c_bus_clear(struct ixgbe_hw *hw) bool ixgbe_tn_check_overtemp(struct ixgbe_hw *hw) { u16 phy_data = 0; - u32 status; + int status; if (hw->device_id != IXGBE_DEV_ID_82599_T3_LOM) return false; @@ -2831,7 +2831,7 @@ bool ixgbe_tn_check_overtemp(struct ixgbe_hw *hw) **/ int ixgbe_set_copper_phy_power(struct ixgbe_hw *hw, bool on) { - u32 status; + int status; u16 reg; /* Bail if we don't have copper phy */ diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c index 76d2fa3..9b14f3b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c @@ -1911,7 +1911,7 @@ static int ixgbe_check_link_t_X550em(struct ixgbe_hw *hw, bool *link_up, bool link_up_wait_to_complete) { - u32 status; + int status; u16 i, autoneg_status; if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) @@ -2330,7 +2330,7 @@ static int ixgbe_get_link_capabilities_X550em(struct ixgbe_hw *hw, static int ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc, bool *is_overtemp) { - u32 status; + int status; u16 reg; *is_overtemp = false; @@ -2418,7 +2418,7 @@ static int ixgbe_get_lasi_ext_t_x550em(struct ixgbe_hw *hw, bool *lsc, static int ixgbe_enable_lasi_ext_t_x550em(struct ixgbe_hw *hw) { bool lsc, overtemp; - u32 status; + int status; u16 reg; /* Clear interrupt flags */ @@ -2512,7 +2512,7 @@ static int ixgbe_handle_lasi_ext_t_x550em(struct ixgbe_hw *hw, { struct ixgbe_phy_info *phy = &hw->phy; bool lsc; - u32 status; + int status; status = ixgbe_get_lasi_ext_t_x550em(hw, &lsc, is_overtemp); if (status) @@ -2606,7 +2606,7 @@ static int ixgbe_setup_kr_x550em(struct ixgbe_hw *hw) **/ static int ixgbe_ext_phy_t_x550em_get_link(struct ixgbe_hw *hw, bool *link_up) { - u32 ret; + int ret; u16 autoneg_status; *link_up = false; @@ -2642,7 +2642,7 @@ static int ixgbe_setup_internal_phy_t_x550em(struct ixgbe_hw *hw) { ixgbe_link_speed force_speed; bool link_up; - u32 status; + int status; u16 speed; if (hw->mac.ops.get_media_type(hw) != ixgbe_media_type_copper) -- 2.52.0