Netdev List
 help / color / mirror / Atom feed
From: Kohei Enju <kohei@enjuk.jp>
To: Ayush Yaduvanshi <ayush37735@gmail.com>
Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: intel: ice: Modernize ice_vsi_free() with scope-based guard(mutex)
Date: Thu, 15 Oct 2026 01:36:35 +0900	[thread overview]
Message-ID: <as-tT0nDrchWa96T@x1> (raw)
In-Reply-To: <20261014110552.56976-1-ayush37735@gmail.com>

On 10/14 16:35, Ayush Yaduvanshi wrote:
> Signed-off-by: Ayush Yaduvanshi <ayush37735@gmail.com>

The commit message is missing, and this patch seems to be a clean-up
patch, which is discouraged in
Documentation/process/maintainer-netdev.rst. Also, this document says:
    Use of ``guard()`` is discouraged within any function longer than 20 lines

> ---
>  drivers/net/ethernet/intel/ice/ice_lib.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c
> index 9e08db376d3d..c695df442822 100644
> --- a/drivers/net/ethernet/intel/ice/ice_lib.c
> +++ b/drivers/net/ethernet/intel/ice/ice_lib.c
> @@ -457,7 +457,7 @@ void ice_vsi_free(struct ice_vsi *vsi)
>  		return;
>  	}
>  
> -	mutex_lock(&pf->sw_mutex);
> +	guard(mutex)(&pf->sw_mutex);
>  	/* updates the PF for this cleared VSI */
>  
>  	pf->vsi[vsi->idx] = NULL;
> @@ -466,7 +466,6 @@ void ice_vsi_free(struct ice_vsi *vsi)
>  	ice_vsi_free_stats(vsi);
>  	ice_vsi_free_arrays(vsi);
>  	mutex_destroy(&vsi->xdp_state_lock);
> -	mutex_unlock(&pf->sw_mutex);
>  	devm_kfree(dev, vsi);

This also extends the critical section, as devm_kfree() is now called
while holding pf->sw_mutex.

Could you please clarify why this change is necessary?

Thanks,
Kohei

>  }
>  
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-10-14 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 11:05 [PATCH] net: intel: ice: Modernize ice_vsi_free() with scope-based guard(mutex) Ayush Yaduvanshi
2026-10-14 16:36 ` Kohei Enju [this message]
2026-10-14 20:22   ` Andrew Lunn

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=as-tT0nDrchWa96T@x1 \
    --to=kohei@enjuk.jp \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ayush37735@gmail.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox