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: <646da4cc-0030-4f11-8a1d-4e4aaa1f609d@redhat.com>
Date: Mon, 18 Nov 2024 12:21:21 +0100
From: Hans de Goede <hdegoede@...hat.com>
To: Yao Zi <ziyao@...root.org>, Kenneth Chan <kenneth.t.chan@...il.com>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: "open list:PANASONIC LAPTOP ACPI EXTRAS DRIVER"
 <platform-driver-x86@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] platform/x86: panasonic-laptop: Return errno correctly in
 show callback

Hi,

On 18-Nov-24 7:46 AM, Yao Zi wrote:
> When an error occurs in sysfs show callback, we should return the errno
> directly instead of formatting it as the result, which produces
> meaningless output and doesn't inform the userspace of the error.
> 
> Fixes: 468f96bfa3a0 ("platform/x86: panasonic-laptop: Add support for battery charging threshold (eco mode)")
> Fixes: d5a81d8e864b ("platform/x86: panasonic-laptop: Add support for optical driver power in Y and W series")
> Signed-off-by: Yao Zi <ziyao@...root.org>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@...hat.com>

Regards,

Hans


> ---
>  drivers/platform/x86/panasonic-laptop.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
> index 2bf94d0ab324..22ca70eb8227 100644
> --- a/drivers/platform/x86/panasonic-laptop.c
> +++ b/drivers/platform/x86/panasonic-laptop.c
> @@ -614,8 +614,7 @@ static ssize_t eco_mode_show(struct device *dev, struct device_attribute *attr,
>  		result = 1;
>  		break;
>  	default:
> -		result = -EIO;
> -		break;
> +		return -EIO;
>  	}
>  	return sysfs_emit(buf, "%u\n", result);
>  }
> @@ -761,7 +760,12 @@ static ssize_t current_brightness_store(struct device *dev, struct device_attrib
>  static ssize_t cdpower_show(struct device *dev, struct device_attribute *attr,
>  			    char *buf)
>  {
> -	return sysfs_emit(buf, "%d\n", get_optd_power_state());
> +	int state = get_optd_power_state();
> +
> +	if (state < 0)
> +		return state;
> +
> +	return sysfs_emit(buf, "%d\n", state);
>  }
>  
>  static ssize_t cdpower_store(struct device *dev, struct device_attribute *attr,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ