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]
Date:   Mon, 18 Jun 2018 09:34:04 +0000
From:   Hugues FRUCHET <hugues.fruchet@...com>
To:     Nicholas Mc Guire <hofrat@...dl.org>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
CC:     Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre TORGUE <alexandre.torgue@...com>,
        Hans Verkuil <hans.verkuil@...co.com>,
        "Philipp Zabel" <p.zabel@...gutronix.de>,
        Niklas Soderlund <niklas.soderlund+renesas@...natech.se>,
        Benjamin Gaignard <benjamin.gaignard@...aro.org>,
        "Gustavo A. R. Silva" <garsilva@...eddedor.com>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] media: stm32-dcmi: drop unnecessary while(1) loop

Hi Nicholas,
thanks for patch !

On 06/12/2018 07:22 PM, Nicholas Mc Guire wrote:
> The while(1) is effectively useless as all possible paths within it
> return thus there is no way to loop.
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@...dl.org>
Acked-by: Hugues Fruchet <hugues.fruchet@...com>

> ---
> 
> This is not actually fixing any bug - the while(1){ } will not hurt here
> it is though simply unnecessary. Found during code review.
> 
> The diff output is not very readable - essentially only the outer
> while(1){ } was removed.
> 
> Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y
> MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y
> CONFIG_VIDEO_STM32_DCMI=y
> (There are a number of sparse warnings - not related to the changes though)
> 
> Patch is against 4.17.0 (localversion-next is next-20180608)
> 
>   drivers/media/platform/stm32/stm32-dcmi.c | 28 +++++++++++++---------------
>   1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 2e1933d..70b81d2 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1605,23 +1605,21 @@ static int dcmi_graph_parse(struct stm32_dcmi *dcmi, struct device_node *node)
>   	struct device_node *ep = NULL;
>   	struct device_node *remote;
>   
> -	while (1) {
> -		ep = of_graph_get_next_endpoint(node, ep);
> -		if (!ep)
> -			return -EINVAL;
> -
> -		remote = of_graph_get_remote_port_parent(ep);
> -		if (!remote) {
> -			of_node_put(ep);
> -			return -EINVAL;
> -		}
> +	ep = of_graph_get_next_endpoint(node, ep);
> +	if (!ep)
> +		return -EINVAL;
>   
> -		/* Remote node to connect */
> -		dcmi->entity.node = remote;
> -		dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
> -		dcmi->entity.asd.match.fwnode = of_fwnode_handle(remote);
> -		return 0;
> +	remote = of_graph_get_remote_port_parent(ep);
> +	if (!remote) {
> +		of_node_put(ep);
> +		return -EINVAL;
>   	}
> +
> +	/* Remote node to connect */
> +	dcmi->entity.node = remote;
> +	dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
> +	dcmi->entity.asd.match.fwnode = of_fwnode_handle(remote);
> +	return 0;
>   }
>   
>   static int dcmi_graph_init(struct stm32_dcmi *dcmi)
> 

BR,
Hugues.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ