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: <2024091300-afford-tamper-1831@gregkh>
Date: Fri, 13 Sep 2024 15:34:58 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Daniel Scally <djrscally@...il.com>,
	Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
	Sakari Ailus <sakari.ailus@...ux.intel.com>,
	"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v1 1/1] software node: Simplify swnode_register() a bit

On Fri, Sep 13, 2024 at 02:05:23PM +0300, Andy Shevchenko wrote:
> By introducing two temporary variables simplify swnode_register() a bit.
> No functional change intended.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/base/swnode.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> index b0be765b12da..810c27a8c9c1 100644
> --- a/drivers/base/swnode.c
> +++ b/drivers/base/swnode.c
> @@ -908,6 +908,7 @@ static struct fwnode_handle *
>  swnode_register(const struct software_node *node, struct swnode *parent,
>  		unsigned int allocated)
>  {
> +	struct kobject *kobj_parent = parent ? &parent->kobj : NULL;

I despise ?: use just so much, EXCEPT for when it's used in something
like this:

>  	struct swnode *swnode;
>  	int ret;
>  
> @@ -934,12 +935,10 @@ swnode_register(const struct software_node *node, struct swnode *parent,
>  
>  	if (node->name)
>  		ret = kobject_init_and_add(&swnode->kobj, &software_node_type,
> -					   parent ? &parent->kobj : NULL,
> -					   "%s", node->name);
> +					   kobj_parent, "%s", node->name);

Which really is the only valid way I'd put up with it :)

So can you rewrite the change above to be just:

	struct kobject *kobj_parent = NULL;

	...

	if (parent)
		kobj_parent = &parent->kobj;

Which is much simpler to read, right?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ