RE: [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal()
From: Loktionov, Aleksandr
Date: Tue Sep 08 2026 - 10:24:33 EST
> -----Original Message-----
> From: Yury Norov <ynorov@xxxxxxxxxx>
> Sent: Thursday, September 3, 2026 3:21 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@xxxxxxxxx>; Andrew Lunn
> <andrew+netdev@xxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>; Eric
> Dumazet <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo
> Abeni <pabeni@xxxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; open list <linux-kernel@xxxxxxxxxxxxxxx>
> Cc: Yury Norov <ynorov@xxxxxxxxxx>
> Subject: [PATCH 2/2] ice: drop pf == NULL check in
> ice_pf_state_is_nominal()
>
> The function has 3 callers, all except one explicitly require pf !=
> NULL. Add the corresponding check to the remaining caller, and remove
> it from the ice_pf_state_is_nominal(). It makse the fun function a
> one-liner.
>
> Signed-off-by: Yury Norov <ynorov@xxxxxxxxxx>
> ---
> drivers/net/ethernet/intel/ice/ice_lib.c | 3 ---
> drivers/net/ethernet/intel/ice/ice_main.c | 2 +-
> 2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c
> b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 73996e3022ef..6d5b8acc4764 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -1705,9 +1705,6 @@ static void ice_vsi_set_rss_flow_fld(struct
> ice_vsi *vsi)
> */
> bool ice_pf_state_is_nominal(struct ice_pf *pf) {
> - if (!pf)
> - return false;
> -
> return bitmap_empty(pf->state, ICE_STATE_NOMINAL_CHECK_BITS);
> }
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> b/drivers/net/ethernet/intel/ice/ice_main.c
> index d88835482d3a..168d85f9477f 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -5521,7 +5521,7 @@ static int ice_suspend(struct device *dev)
>
> pf = pci_get_drvdata(pdev);
>
> - if (!ice_pf_state_is_nominal(pf)) {
> + if (!pf || !ice_pf_state_is_nominal(pf)) {
> dev_err(dev, "Device is not ready, no need to suspend
> it\n");
> return -EBUSY;
> }
> --
> 2.53.0
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@xxxxxxxxx>