* RE: [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal()
2026-09-03 13:20 ` [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal() Yury Norov
@ 2026-09-03 15:29 ` Temerkhanov, Sergey
2026-09-05 18:32 ` Simon Horman
2026-09-08 13:13 ` Loktionov, Aleksandr
2 siblings, 0 replies; 11+ messages in thread
From: Temerkhanov, Sergey @ 2026-09-03 15:29 UTC (permalink / raw)
To: Yury Norov, Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
open list
> -----Original Message-----
> From: Yury Norov <ynorov@nvidia.com>
> Sent: Thursday, September 3, 2026 3:21 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
> David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; open list <linux-kernel@vger.kernel.org>
> Cc: Yury Norov <ynorov@nvidia.com>
> 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@nvidia.com>
> ---
> 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: Sergey Temerkhanov <sergey.temerkhanov@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal()
2026-09-03 13:20 ` [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal() Yury Norov
2026-09-03 15:29 ` Temerkhanov, Sergey
@ 2026-09-05 18:32 ` Simon Horman
2026-09-05 23:52 ` Yury Norov
2026-09-08 13:13 ` Loktionov, Aleksandr
2 siblings, 1 reply; 11+ messages in thread
From: Simon Horman @ 2026-09-05 18:32 UTC (permalink / raw)
To: Yury Norov
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, intel-wired-lan,
netdev, open list
On Thu, Sep 03, 2026 at 09:20:36AM -0400, Yury Norov wrote:
> 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@nvidia.com>
> ---
> 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;
> }
Is the new condition necessary in ice_suspend?
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal()
2026-09-05 18:32 ` Simon Horman
@ 2026-09-05 23:52 ` Yury Norov
2026-09-08 12:20 ` Simon Horman
0 siblings, 1 reply; 11+ messages in thread
From: Yury Norov @ 2026-09-05 23:52 UTC (permalink / raw)
To: Simon Horman
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, intel-wired-lan,
netdev, open list
On Sat, Sep 05, 2026 at 07:32:45PM +0100, Simon Horman wrote:
> On Thu, Sep 03, 2026 at 09:20:36AM -0400, Yury Norov wrote:
> > 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@nvidia.com>
> > ---
> > 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;
> > }
>
> Is the new condition necessary in ice_suspend?
IDK. I'm just trying to stay on the safe side. The
ice_pf_state_is_nominal() was safe against pf == NULL,
so I'm trying to preserve the invariant.
If it's impossible, I can do:
if (WARN_ON(!pf) || !ice_pf_state_is_nominal(pf))
This would imply unlikely(), and more verbose than an implied
assumption that pf is never uninitialized.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal()
2026-09-05 23:52 ` Yury Norov
@ 2026-09-08 12:20 ` Simon Horman
0 siblings, 0 replies; 11+ messages in thread
From: Simon Horman @ 2026-09-08 12:20 UTC (permalink / raw)
To: Yury Norov
Cc: Tony Nguyen, Przemek Kitszel, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, intel-wired-lan,
netdev, open list
On Sat, Sep 05, 2026 at 07:52:44PM -0400, Yury Norov wrote:
> On Sat, Sep 05, 2026 at 07:32:45PM +0100, Simon Horman wrote:
> > On Thu, Sep 03, 2026 at 09:20:36AM -0400, Yury Norov wrote:
> > > 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@nvidia.com>
> > > ---
> > > 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;
> > > }
> >
> > Is the new condition necessary in ice_suspend?
>
> IDK. I'm just trying to stay on the safe side. The
> ice_pf_state_is_nominal() was safe against pf == NULL,
> so I'm trying to preserve the invariant.
>
> If it's impossible, I can do:
>
> if (WARN_ON(!pf) || !ice_pf_state_is_nominal(pf))
>
> This would imply unlikely(), and more verbose than an implied
> assumption that pf is never uninitialized.
Let's stick with what you've got.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* RE: [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal()
2026-09-03 13:20 ` [PATCH 2/2] ice: drop pf == NULL check in ice_pf_state_is_nominal() Yury Norov
2026-09-03 15:29 ` Temerkhanov, Sergey
2026-09-05 18:32 ` Simon Horman
@ 2026-09-08 13:13 ` Loktionov, Aleksandr
2 siblings, 0 replies; 11+ messages in thread
From: Loktionov, Aleksandr @ 2026-09-08 13:13 UTC (permalink / raw)
To: Yury Norov, Nguyen, Anthony L, Kitszel, Przemyslaw, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
open list
> -----Original Message-----
> From: Yury Norov <ynorov@nvidia.com>
> Sent: Thursday, September 3, 2026 3:21 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel,
> Przemyslaw <przemyslaw.kitszel@intel.com>; Andrew Lunn
> <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; open list <linux-kernel@vger.kernel.org>
> Cc: Yury Norov <ynorov@nvidia.com>
> 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@nvidia.com>
> ---
> 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@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread