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] [day] [month] [year] [list]
Message-ID: <Zxey3Y9YkFATfwB2@kuha.fi.intel.com>
Date: Tue, 22 Oct 2024 17:12:45 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Hans de Goede <hdegoede@...hat.com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] usb: typec: use cleanup facility for
 'altmodes_node'

On Mon, Oct 21, 2024 at 10:45:30PM +0200, Javier Carrasco wrote:
> Use the __free() macro for 'altmodes_node' to automatically release the
> node when it goes out of scope, removing the need for explicit calls to
> fwnode_handle_put().
> 
> Suggested-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
>  drivers/usb/typec/class.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 1eb240604cf6..58f40156de56 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -2293,7 +2293,7 @@ void typec_port_register_altmodes(struct typec_port *port,
>  	const struct typec_altmode_ops *ops, void *drvdata,
>  	struct typec_altmode **altmodes, size_t n)
>  {
> -	struct fwnode_handle *altmodes_node, *child;
> +	struct fwnode_handle *child;
>  	struct typec_altmode_desc desc;
>  	struct typec_altmode *alt;
>  	size_t index = 0;
> @@ -2301,7 +2301,9 @@ void typec_port_register_altmodes(struct typec_port *port,
>  	u32 vdo;
>  	int ret;
>  
> -	altmodes_node = device_get_named_child_node(&port->dev, "altmodes");
> +	struct fwnode_handle *altmodes_node  __free(fwnode_handle) =
> +		device_get_named_child_node(&port->dev, "altmodes");
> +
>  	if (!altmodes_node)
>  		return; /* No altmodes specified */
>  
> @@ -2341,7 +2343,6 @@ void typec_port_register_altmodes(struct typec_port *port,
>  		altmodes[index] = alt;
>  		index++;
>  	}
> -	fwnode_handle_put(altmodes_node);
>  }
>  EXPORT_SYMBOL_GPL(typec_port_register_altmodes);
>  

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ