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]
Message-ID: <373d62da-810f-492c-af2f-53b32cc90b33@acm.org>
Date: Thu, 6 Feb 2025 12:31:14 -0800
From: Bart Van Assche <bvanassche@....org>
To: Sean Anderson <sean.anderson@...ux.dev>,
 Laurent Pinchart <laurent.pinchart@...asonboard.com>,
 Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
 "open list:DRM DRIVERS FOR XILINX" <dri-devel@...ts.freedesktop.org>
Cc: Thomas Zimmermann <tzimmermann@...e.de>,
 "moderated list:ARM/ZYNQ ARCHITECTURE"
 <linux-arm-kernel@...ts.infradead.org>,
 open list <linux-kernel@...r.kernel.org>, David Airlie <airlied@...il.com>,
 Dan Carpenter <dan.carpenter@...aro.org>, Michal Simek
 <michal.simek@....com>, Maxime Ripard <mripard@...nel.org>,
 Simona Vetter <simona@...ll.ch>,
 Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>
Subject: Re: [PATCH 2/2] drm: zynqmp_dp: Use scope-based mutex helpers

On 2/6/25 11:41 AM, Sean Anderson wrote:
>   static int zynqmp_dp_enhanced_set(void *data, u64 val)
>   {
>   	struct zynqmp_dp *dp = data;
> -	int ret = 0;
>   
> -	mutex_lock(&dp->lock);
> +	guard(mutex)(&dp->lock);
>   	dp->test.enhanced = val;
>   	if (dp->test.active)
> -		ret = zynqmp_dp_test_setup(dp);
> -	mutex_unlock(&dp->lock);
> +		return zynqmp_dp_test_setup(dp);
>   
> -	return ret;
> +	return 0;
>   }

Has it been considered to combine the two return statements into one
with the ternary operator (?:)?

>   static int zynqmp_dp_downspread_set(void *data, u64 val)
>   {
>   	struct zynqmp_dp *dp = data;
> -	int ret = 0;
>   
> -	mutex_lock(&dp->lock);
> +	guard(mutex)(&dp->lock);
>   	dp->test.downspread = val;
>   	if (dp->test.active)
> -		ret = zynqmp_dp_test_setup(dp);
> -	mutex_unlock(&dp->lock);
> +		return zynqmp_dp_test_setup(dp);
>   
> -	return ret;
> +	return 0;
>   }

Same question here.

> @@ -2053,7 +2039,8 @@ static ssize_t zynqmp_dp_custom_read(struct file *file, char __user *user_buf,
>   		return ret;
>   
>   	mutex_lock(&dp->lock);
> -	ret = simple_read_from_buffer(user_buf, count, ppos, &dp->test.custom,
> +	ret = simple_read_from_buffer(user_buf, count, ppos,
> +				      &dp->test.custom,
>   				      sizeof(dp->test.custom));

This change has not been mentioned in the patch description and is not
related to the other changes in this patch?

> -	return ret;
> +	dp->test.link_cnt = val;
> +	if (dp->test.active)
> +		return zynqmp_dp_test_setup(dp);
> +
> +	return 0;
>   }

Has it been considered to use the ternary operator here?

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ