mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: intel: ice: Modernize ice_vsi_free() with scope-based guard(mutex)
@ 2026-10-14 11:05 Ayush Yaduvanshi
  2026-10-14 16:36 ` Kohei Enju
  0 siblings, 1 reply; 2+ messages in thread
From: Ayush Yaduvanshi @ 2026-10-14 11:05 UTC (permalink / raw)
  To: anthony.l.nguyen
  Cc: przemyslaw.kitszel, intel-wired-lan, netdev, linux-kernel,
	Ayush Yaduvanshi

Signed-off-by: Ayush Yaduvanshi <ayush37735@gmail.com>
---
 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);
 }
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: intel: ice: Modernize ice_vsi_free() with scope-based guard(mutex)
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Kohei Enju @ 2026-10-14 16:36 UTC (permalink / raw)
  To: Ayush Yaduvanshi
  Cc: anthony.l.nguyen, przemyslaw.kitszel, intel-wired-lan, netdev,
	linux-kernel

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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-14 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®