Re: [PATCH] net: intel: ice: Modernize ice_vsi_free() with scope-based guard(mutex)
From: Kohei Enju
Date: Wed Oct 14 2026 - 13:41:21 EST
On 10/14 16:35, Ayush Yaduvanshi wrote:
> Signed-off-by: Ayush Yaduvanshi <ayush37735@xxxxxxxxx>
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
>