mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
usb: typec: use cleanup facility for 'altmodes_node'
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@linux.intel.com> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20241021-typec-class-fwnode_handle_put-v2-2-3281225d3d27@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9581acb91e
commit
1ab0b9ae58
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user