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: <2025082052-crawfish-revisable-7965@gregkh>
Date: Wed, 20 Aug 2025 13:15:27 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Michael Hennerich <michael.hennerich@...log.com>,
	Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] misc: ad525x_dpot: Use str_enabled_disabled() in
 sysfs_show_reg()

On Wed, Aug 20, 2025 at 12:27:34PM +0200, Thorsten Blum wrote:
> Remove hard-coded strings by using the str_enabled_disabled() helper
> function and silence the following Coccinelle/coccicheck warning
> reported by string_choices.cocci:
> 
>   opportunity for str_enabled_disabled(..)
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> ---
>  drivers/misc/ad525x_dpot.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
> index 756ef6912b5a..04683b981e54 100644
> --- a/drivers/misc/ad525x_dpot.c
> +++ b/drivers/misc/ad525x_dpot.c
> @@ -73,6 +73,7 @@
>  #include <linux/kernel.h>
>  #include <linux/delay.h>
>  #include <linux/slab.h>
> +#include <linux/string_choices.h>
>  
>  #include "ad525x_dpot.h"
>  
> @@ -418,10 +419,8 @@ static ssize_t sysfs_show_reg(struct device *dev,
>  	s32 value;
>  
>  	if (reg & DPOT_ADDR_OTP_EN)
> -		return sprintf(buf, "%s\n",
> -			test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask) ?
> -			"enabled" : "disabled");
> -
> +		return sprintf(buf, "%s\n", str_enabled_disabled(
> +			test_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask)));

If you are going to change this, might as well call sysfs_emit() as
well, right?

that way you get two coccicheck warnings at once :)

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ