[PATCH 0/2] staging: rtl8723bs: Use scoped_guard for mutex handling

Erick Karanja posted 2 patches 1 year ago
drivers/staging/rtl8723bs/core/rtw_cmd.c     |  14 +-
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 281 +++++++++----------
2 files changed, 132 insertions(+), 163 deletions(-)
[PATCH 0/2] staging: rtl8723bs: Use scoped_guard for mutex handling
Posted by Erick Karanja 1 year ago
This patchset updates the rtl8723bs driver by replacing manual mutex lock and
unlock operations with scoped_guard(), aiming to improve code clarity and
safety through automatic resource management. This change makes the code
more resilient to early returns and error paths.

Erick Karanja (2):
  staging: rtl8723bs: Replace manual mutex handling with scoped_guard()
  staging: rtl8723bs: Switch mutexes to scoped_guard

 drivers/staging/rtl8723bs/core/rtw_cmd.c     |  14 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 281 +++++++++----------
 2 files changed, 132 insertions(+), 163 deletions(-)

-- 
2.43.0
Re: [PATCH 0/2] staging: rtl8723bs: Use scoped_guard for mutex handling
Posted by Greg KH 1 year ago
On Thu, Apr 24, 2025 at 10:56:24PM +0300, Erick Karanja wrote:
> This patchset updates the rtl8723bs driver by replacing manual mutex lock and
> unlock operations with scoped_guard(), aiming to improve code clarity and
> safety through automatic resource management. This change makes the code
> more resilient to early returns and error paths.

But the places you changed do not have early returns or error paths, so
this really is just unneeded churn :(

scope_guard() is great, please use it for new code, or for places with
lots of returns or error paths.  But not for just general "let's convert
the driver to use this!" type of things, as that's not needed at all.

Also, for changes like this, I'd like to see the code actually tested to
verify it all is still working properly, as mistakes here can be very
common to cause.

thanks,

greg k-h