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: <20241216151931.00006519@huawei.com>
Date: Mon, 16 Dec 2024 15:19:31 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Zijun Hu <zijun_hu@...oud.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
	<rafael@...nel.org>, Tejun Heo <tj@...nel.org>, Josef Bacik
	<josef@...icpanda.com>, Jens Axboe <axboe@...nel.dk>, Boris Burkov
	<boris@....io>, Davidlohr Bueso <dave@...olabs.net>, Dave Jiang
	<dave.jiang@...el.com>, Alison Schofield <alison.schofield@...el.com>, Vishal
 Verma <vishal.l.verma@...el.com>, Ira Weiny <ira.weiny@...el.com>, Dan
 Williams <dan.j.williams@...el.com>, <linux-kernel@...r.kernel.org>,
	<cgroups@...r.kernel.org>, <linux-block@...r.kernel.org>,
	<linux-cxl@...r.kernel.org>, Zijun Hu <quic_zijuhu@...cinc.com>
Subject: Re: [PATCH v3 5/9] driver core: Move true expression out of if
 condition in API device_find_child()

On Thu, 12 Dec 2024 21:38:41 +0800
Zijun Hu <zijun_hu@...oud.com> wrote:

> From: Zijun Hu <quic_zijuhu@...cinc.com>
> 
> For device_find_child(), get_device() in the if condition always returns
> true, move it to if body to make the API's logic more clearer.
> 
> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
I'd squash with previous 2.  They are all the same change in the same
area of the kernel.

Jonathan

> ---
>  drivers/base/core.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 8bdbc9e657e832a063542391426f570ccb5c18b9..69bb6bf4bd12395226ee3c99e2f63d15c7e342a5 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -4089,9 +4089,12 @@ struct device *device_find_child(struct device *parent, const void *data,
>  		return NULL;
>  
>  	klist_iter_init(&parent->p->klist_children, &i);
> -	while ((child = next_device(&i)))
> -		if (match(child, data) && get_device(child))
> +	while ((child = next_device(&i))) {
> +		if (match(child, data)) {
> +			get_device(child);
>  			break;
> +		}
> +	}
>  	klist_iter_exit(&i);
>  	return child;
>  }
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ