diff mbox series

usb: typec: Drop reference to a fwnode

Message ID 20241102022914.208634-1-joe@pf.is.s.u-tokyo.ac.jp (mailing list archive)
State Superseded
Headers show
Series usb: typec: Drop reference to a fwnode | expand

Commit Message

Joe Hattori Nov. 2, 2024, 2:29 a.m. UTC
In typec_port_register_altmodes(), the fwnode reference obtained by
device_get_named_child_node() is not dropped. This commit adds a call to
fwnode_handle_put() to fix the possible reference leak.

Fixes: 7b458a4c5d73 ("usb: typec: Add typec_port_register_altmodes()")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
---
 drivers/usb/typec/class.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Greg KH Nov. 3, 2024, 11:19 p.m. UTC | #1
On Sat, Nov 02, 2024 at 11:29:14AM +0900, Joe Hattori wrote:
> In typec_port_register_altmodes(), the fwnode reference obtained by
> device_get_named_child_node() is not dropped. This commit adds a call to
> fwnode_handle_put() to fix the possible reference leak.
> 
> Fixes: 7b458a4c5d73 ("usb: typec: Add typec_port_register_altmodes()")
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
> ---
>  drivers/usb/typec/class.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index d61b4c74648d..1eb240604cf6 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -2341,6 +2341,7 @@ 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);
>  
> -- 
> 2.34.1
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You have marked a patch with a "Fixes:" tag for a commit that is in an
  older released kernel, yet you do not have a cc: stable line in the
  signed-off-by area at all, which means that the patch will not be
  applied to any older kernel releases.  To properly fix this, please
  follow the documented rules in the
  Documentation/process/stable-kernel-rules.rst file for how to resolve
  this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
diff mbox series

Patch

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index d61b4c74648d..1eb240604cf6 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -2341,6 +2341,7 @@  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);