All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
	netdev@vger.kernel.org, Lukasz Czapnik <lukasz.czapnik@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next] ice: fix AQ error code comparison in ice_set_pauseparam()
Date: Fri, 3 Apr 2026 13:10:32 +0100	[thread overview]
Message-ID: <20260403121032.GA70436@horms.kernel.org> (raw)
In-Reply-To: <20260327072236.129802-4-aleksandr.loktionov@intel.com>

On Fri, Mar 27, 2026 at 08:22:35AM +0100, Aleksandr Loktionov wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
> 
> 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().

I think that this second part feels more like a clean-up
than part of the fix. But I don't feel strongly about it.

> Fixes: fcea6f3da546 ("ice: Add stats and ethtool support")
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

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

> ---
> 
>  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;

FWIIW, I think the defensive code above could also be removed at some point.

>  
> -	*aq_failures = 0;
>  	hw = pi->hw;
>  
>  	pcaps = kzalloc_obj(*pcaps);

...

WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Cc: intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com,
	netdev@vger.kernel.org, Lukasz Czapnik <lukasz.czapnik@intel.com>
Subject: Re: [PATCH iwl-next] ice: fix AQ error code comparison in ice_set_pauseparam()
Date: Fri, 3 Apr 2026 13:10:32 +0100	[thread overview]
Message-ID: <20260403121032.GA70436@horms.kernel.org> (raw)
In-Reply-To: <20260327072236.129802-4-aleksandr.loktionov@intel.com>

On Fri, Mar 27, 2026 at 08:22:35AM +0100, Aleksandr Loktionov wrote:
> From: Lukasz Czapnik <lukasz.czapnik@intel.com>
> 
> 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().

I think that this second part feels more like a clean-up
than part of the fix. But I don't feel strongly about it.

> Fixes: fcea6f3da546 ("ice: Add stats and ethtool support")
> Signed-off-by: Lukasz Czapnik <lukasz.czapnik@intel.com>
> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>

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

> ---
> 
>  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;

FWIIW, I think the defensive code above could also be removed at some point.

>  
> -	*aq_failures = 0;
>  	hw = pi->hw;
>  
>  	pcaps = kzalloc_obj(*pcaps);

...

  reply	other threads:[~2026-04-03 12:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  7:22 [Intel-wired-lan] [PATCH iwl-next] ice: fix FDIR CTRL VSI resource leak in ice_reset_all_vfs() Aleksandr Loktionov
2026-03-27  7:22 ` Aleksandr Loktionov
2026-03-27  7:22 ` [Intel-wired-lan] [PATCH iwl-next] ice: do not reset MDD counters on VF reset Aleksandr Loktionov
2026-03-27  7:22   ` Aleksandr Loktionov
2026-04-01 23:14   ` [Intel-wired-lan] " Tony Nguyen
2026-04-01 23:14     ` Tony Nguyen
2026-03-27  7:22 ` [Intel-wired-lan] [PATCH iwl-next] ice: check cross-timestamp timeout bits Aleksandr Loktionov
2026-03-27  7:22   ` Aleksandr Loktionov
2026-04-02  0:01   ` [Intel-wired-lan] " Jacob Keller
2026-04-03  9:03   ` Simon Horman
2026-04-03  9:03     ` Simon Horman
2026-03-27  7:22 ` [Intel-wired-lan] [PATCH iwl-next] ice: fix AQ error code comparison in ice_set_pauseparam() Aleksandr Loktionov
2026-03-27  7:22   ` Aleksandr Loktionov
2026-04-03 12:10   ` Simon Horman [this message]
2026-04-03 12:10     ` Simon Horman
2026-05-08  9:27   ` [Intel-wired-lan] " Rinitha, SX
2026-05-08  9:27     ` Rinitha, SX
2026-03-27  7:22 ` [Intel-wired-lan] [PATCH iwl-next] ice: call netif_keep_dst() once when entering switchdev mode Aleksandr Loktionov
2026-03-27  7:22   ` Aleksandr Loktionov
2026-04-03 12:41   ` [Intel-wired-lan] " Simon Horman
2026-04-03 12:41     ` Simon Horman
2026-04-14 13:13     ` [Intel-wired-lan] " Holda, Patryk
2026-04-14 13:13       ` Holda, Patryk
2026-04-03 11:57 ` [Intel-wired-lan] [PATCH iwl-next] ice: fix FDIR CTRL VSI resource leak in ice_reset_all_vfs() Simon Horman
2026-04-03 11:57   ` Simon Horman
2026-04-13 15:51   ` [Intel-wired-lan] " Romanowski, Rafal
2026-04-13 15:51     ` Romanowski, Rafal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260403121032.GA70436@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=aleksandr.loktionov@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=lukasz.czapnik@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.