From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 74D0F2D73AE for ; Fri, 27 Mar 2026 07:22:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774596169; cv=none; b=AEsf571/HVqeoHViiJ+qnE6KkXS1+3przL6/A6E8aof/T304Sj60P2zrMjFS5arRrYPNOI6aTsKORhlgqMM5ncijqZt0rEo3fVnsYCxp5jGqsFROEPuiwaDdshDdDOQUxuRuVkSOokhWGl+OPLgg4AIXsSD5WE4sSJl0Xjb7Llk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774596169; c=relaxed/simple; bh=NPzE/oAt4YAyOSuZTJ7ABZ8cwWD0xhoFinLo3gs+8r8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pZMem8OpRSpwkBSxqreetK6tITzqc8gWeICa7Cw0XafkhEaEu9q3OY6M+JoIgweI92LNViXEelyeYWG7HXfe+HjJTRLmx/1xP+eZIotC8XXsBqHtVeMvdIRHCZYS60wdFoPPIMB+08adyhZPw8PvRC5YZUgpAk+BEuvzAfLDd5c= 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=B3jRB//M; arc=none smtp.client-ip=192.198.163.18 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="B3jRB//M" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774596164; x=1806132164; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NPzE/oAt4YAyOSuZTJ7ABZ8cwWD0xhoFinLo3gs+8r8=; b=B3jRB//MZnYLR8AXH2/xfTvyLUZFeOBiCkkI4TlXRyFboXT1sQe48ymi 76ggW+HUWHk9Jo2dF5wjJj0Mc2gToSVoIVK7urkujw+PtgNoM3hNcswmF BW7GI8YuqvrChb3uG6aOj5H1S0xlp2TqeqMzpFUne+fyigpTHuycOfWMP 0dXqHEexy0Oam4grXmUZoEuI6UvUcOlx9ecZapBqiY98GmxZIDG6K5ePn f7UKztLkPeJZw1C1l8lnzTt/MawH+DNjo1Ev44dSr1LUvIbdoIgm8ku53 JDpx+DIuXKt1NC/LSUSkljejzhw7HEKdAfH78jcBki7ImoqzXlsf+O9V5 w==; X-CSE-ConnectionGUID: RthIeBKWQ1KbtF1CfRey4Q== X-CSE-MsgGUID: k7pyyFD6TteKERT1OUfWSA== X-IronPort-AV: E=McAfee;i="6800,10657,11741"; a="74848619" X-IronPort-AV: E=Sophos;i="6.23,143,1770624000"; d="scan'208";a="74848619" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2026 00:22:42 -0700 X-CSE-ConnectionGUID: 955Bkq6PQkykoS+cUp64Ng== X-CSE-MsgGUID: t9hH/tsHQxWCvK2Q9LqugQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,143,1770624000"; d="scan'208";a="222359563" Received: from amlin-019-225.igk.intel.com ([10.102.19.225]) by fmviesa008.fm.intel.com with ESMTP; 27 Mar 2026 00:22:41 -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, Lukasz Czapnik Subject: [PATCH iwl-next] ice: fix AQ error code comparison in ice_set_pauseparam() Date: Fri, 27 Mar 2026 08:22:35 +0100 Message-ID: <20260327072236.129802-4-aleksandr.loktionov@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260327072236.129802-1-aleksandr.loktionov@intel.com> References: <20260327072236.129802-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 From: Lukasz Czapnik Fix unreachable code: the conditionals in ice_set_pauseparam() used the bitwise-AND operator suggesting aq_failures is a bitmap, but it is actually an enum, making the third condition logically unreachable. Replace the if-else ladder with a switch statement. Also move the aq_failures initialization to the variable declaration and remove the redundant zeroing from ice_set_fc(). Fixes: fcea6f3da546 ("ice: Add stats and ethtool support") Signed-off-by: Lukasz Czapnik Signed-off-by: Aleksandr Loktionov --- drivers/net/ethernet/intel/ice/ice_common.c | 1 - drivers/net/ethernet/intel/ice/ice_ethtool.c | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c index f1a6601..6dad7d4 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -3883,7 +3883,6 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update) if (!pi || !aq_failures) return -EINVAL; - *aq_failures = 0; hw = pi->hw; pcaps = kzalloc_obj(*pcaps); diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 2a4f06f..0cf064c 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -3501,7 +3501,7 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) struct ice_vsi *vsi = np->vsi; struct ice_hw *hw = &pf->hw; struct ice_port_info *pi; - u8 aq_failures; + u8 aq_failures = 0; bool link_up; u32 is_an; int err; @@ -3572,18 +3572,22 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) /* Set the FC mode and only restart AN if link is up */ err = ice_set_fc(pi, &aq_failures, link_up); - if (aq_failures & ICE_SET_FC_AQ_FAIL_GET) { + switch (aq_failures) { + case ICE_SET_FC_AQ_FAIL_GET: netdev_info(netdev, "Set fc failed on the get_phy_capabilities call with err %d aq_err %s\n", err, libie_aq_str(hw->adminq.sq_last_status)); err = -EAGAIN; - } else if (aq_failures & ICE_SET_FC_AQ_FAIL_SET) { + break; + case ICE_SET_FC_AQ_FAIL_SET: netdev_info(netdev, "Set fc failed on the set_phy_config call with err %d aq_err %s\n", err, libie_aq_str(hw->adminq.sq_last_status)); err = -EAGAIN; - } else if (aq_failures & ICE_SET_FC_AQ_FAIL_UPDATE) { + break; + case ICE_SET_FC_AQ_FAIL_UPDATE: netdev_info(netdev, "Set fc failed on the get_link_info call with err %d aq_err %s\n", err, libie_aq_str(hw->adminq.sq_last_status)); err = -EAGAIN; + break; } return err; -- 2.52.0