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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 7 Apr 2023 09:10:15 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Eddie James <eajames@...ux.ibm.com>
Cc:     linux-hwmon@...r.kernel.org, linux-kernel@...r.kernel.org,
        jdelvare@...e.com
Subject: Re: [PATCH 2/2] hwmon: (pmbus/ibm-cffps) Use default debugfs
 attributes and lock function

On Wed, Apr 05, 2023 at 09:52:30AM -0500, Eddie James wrote:
> Switch the driver to use the default debugfs attributes instead of
> ones that provide the same data under different names. Use the lock
> functions for the debugfs and led attributes, and simplify the input
> history operation by dropping the timer and lock.
> 
> Signed-off-by: Eddie James <eajames@...ux.ibm.com>
> ---
>  drivers/hwmon/pmbus/ibm-cffps.c | 273 ++++++++++++++------------------
>  1 file changed, 118 insertions(+), 155 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/ibm-cffps.c b/drivers/hwmon/pmbus/ibm-cffps.c
> index e3294a1a54bb..2d7ec00e047b 100644
> --- a/drivers/hwmon/pmbus/ibm-cffps.c
> +++ b/drivers/hwmon/pmbus/ibm-cffps.c
> @@ -18,12 +18,6 @@
>  
[ ... ]
>  			}
> @@ -225,29 +183,27 @@ static ssize_t ibm_cffps_debugfs_read(struct file *file, char __user *buf,
>  			rc = i * 4;
>  			break;
>  		default:
> -			return -EOPNOTSUPP;
> +			rc = -EOPNOTSUPP;
> +			break;
>  		}
> -		goto done;
> +		break;
>  	case CFFPS_DEBUGFS_ON_OFF_CONFIG:
> -		rc = i2c_smbus_read_byte_data(psu->client,
> -					      PMBUS_ON_OFF_CONFIG);
> -		if (rc < 0)
> -			return rc;
> -
> -		rc = snprintf(data, 3, "%02x", rc);
> -		goto done;
> +		rc = i2c_smbus_read_byte_data(psu->client, PMBUS_ON_OFF_CONFIG);
> +		if (rc >= 0)
> +			rc = snprintf(data, 3, "%02x", rc);
> +		break;
>  	default:
> -		return -EINVAL;
> +		rc = -EINVAL;
> +		break;
>  	}
>  
> -	rc = i2c_smbus_read_block_data(psu->client, cmd, data);
> +unlock:
> +	pmbus_unlock(psu->client);
>  	if (rc < 0)
>  		return rc;
>  
> -done:
>  	data[rc] = '\n';
>  	rc += 2;
> -

I hate to say (repeat) that, but please refrain from whitespace changes.

Guenter

>  	return simple_read_from_buffer(buf, count, ppos, data, rc);
>  }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ