lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240627070834.GC2532839@google.com>
Date: Thu, 27 Jun 2024 08:08:34 +0100
From: Lee Jones <lee@...nel.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Christian Marangi <ansuelsmth@...il.com>, linux-leds@...r.kernel.org,
	Pavel Machek <pavel@....cz>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] leds: leds-lp55xx: Convert mutex lock/unlock to
 guard API

On Thu, 27 Jun 2024, Markus Elfring wrote:

> > Convert any entry of mutex lock/unlock to guard API and simplify code.
> 
> Thanks that you would like to support another bit of collateral evolution.
> 
> * Would you get into the mood to benefit any more from applications
>   of scope-based resource management?
> 
> * Will development interests accordingly grow to adjust further source code places
>   according to known pairs of function calls?
> 
> 
> > With the use of guard API, handling for selttest functions can be
> 
>                                           selftest?
> 
> 
> > greatly simplified.
> 
> I find cover letters helpful for patch series.
> 
> 
> …
> > +++ b/drivers/leds/leds-lp5521.c
> > @@ -9,6 +9,7 @@
> >   *          Milo(Woogyom) Kim <milo.kim@...com>
> >   */
> >
> > +#include <linux/cleanup.h>
> >  #include <linux/delay.h>
> >  #include <linux/firmware.h>
> …
> 
> I guess that this proposed addition is not directly needed here (and related places)
> because the header file is included for the macro call “DEFINE_GUARD(mutex, …)” already.
> https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/mutex.h#L22
> 
> 
> …
> > @@ -185,9 +186,9 @@ static ssize_t lp5521_selftest(struct device *dev,
> >  	struct lp55xx_chip *chip = led->chip;
> >  	int ret;
> >
> > -	mutex_lock(&chip->lock);
> > +	guard(mutex, &chip->lock);
> > +
> >  	ret = lp5521_run_selftest(chip, buf);
> > -	mutex_unlock(&chip->lock);
> >
> >  	return sysfs_emit(buf, "%s\n", ret ? "FAIL" : "OK");
> >  }
> …
> 
> How do you think about to omit any blank lines (also at similar places)?

Please do not omit the blank lines.

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ