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: <4113bbafa3c69526392f9be5dcdff86a72f339a3.camel@pengutronix.de>
Date:   Mon, 17 Jul 2023 11:58:48 +0200
From:   Lucas Stach <l.stach@...gutronix.de>
To:     Sui Jingfeng <sui.jingfeng@...ux.dev>,
        Russell King <linux+etnaviv@...linux.org.uk>,
        Christian Gmeiner <christian.gmeiner@...il.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>
Cc:     loongson-kernel@...ts.loongnix.cn,
        Sui Jingfeng <suijingfeng@...ngson.cn>,
        etnaviv@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 4/8] drm/etnaviv: Remove surplus else after return

Am Freitag, dem 23.06.2023 um 18:08 +0800 schrieb Sui Jingfeng:
> From: Sui Jingfeng <suijingfeng@...ngson.cn>
> 
> Because the 'else' is not generally useful after the 'return'.

While your cleanup is a correct rewrite of the function, the current
code in this function is bogus, as we need to check for the
bidirectional (READ | WRITE) case first. Currently we just pick the
DMA_FROM_DEVICE direction when both flags are set, which is clearly not
right.

Regards,
Lucas

> 
> Signed-off-by: Sui Jingfeng <suijingfeng@...ngson.cn>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> index be2f459c66b5..271470723d5e 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
> @@ -358,10 +358,11 @@ static inline enum dma_data_direction etnaviv_op_to_dma_dir(u32 op)
>  {
>  	if (op & ETNA_PREP_READ)
>  		return DMA_FROM_DEVICE;
> -	else if (op & ETNA_PREP_WRITE)
> +
> +	if (op & ETNA_PREP_WRITE)
>  		return DMA_TO_DEVICE;
> -	else
> -		return DMA_BIDIRECTIONAL;
> +
> +	return DMA_BIDIRECTIONAL;
>  }
>  
>  int etnaviv_gem_cpu_prep(struct drm_gem_object *obj, u32 op,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ