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] [day] [month] [year] [list]
Message-ID: <Z4Z-SJZIekQ3SjP4@hovoldconsulting.com>
Date: Tue, 14 Jan 2025 16:10:00 +0100
From: Johan Hovold <johan@...nel.org>
To: Nobuhiro Iwamatsu <iwamatsu@...auri.org>
Cc: Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH] gnss: mtk: Simplify return variables in mtk_set_active
 and mtk_set_standby

On Sun, Nov 17, 2024 at 02:25:01PM +0900, Nobuhiro Iwamatsu wrote:
> Simply return directly instead of assign the return value.
> 
> Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@...auri.org>
> ---
>  drivers/gnss/mtk.c | 14 ++------------
>  1 file changed, 2 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gnss/mtk.c b/drivers/gnss/mtk.c
> index c62b1211f4fe4e..be20f6d6470736 100644
> --- a/drivers/gnss/mtk.c
> +++ b/drivers/gnss/mtk.c
> @@ -24,25 +24,15 @@ struct mtk_data {
>  static int mtk_set_active(struct gnss_serial *gserial)
>  {
>  	struct mtk_data *data = gnss_serial_get_drvdata(gserial);
> -	int ret;
>  
> -	ret = regulator_enable(data->vcc);
> -	if (ret)
> -		return ret;
> -
> -	return 0;
> +	return regulator_enable(data->vcc);

The current style with separate success and error paths was used on
purpose (e.g. to make it obvious from just looking at this function to
determine what is returned).

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ