From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v2] usb: typec: anx7411: fix OF node reference leaks in anx7411_typec_switch_probe()
Date: Tue, 19 Nov 2024 17:40:07 +0200 [thread overview]
Message-ID: <ZzyxV6xoMjgIEACe@kuha.fi.intel.com> (raw)
In-Reply-To: <20241116085503.3835860-1-joe@pf.is.s.u-tokyo.ac.jp>
On Sat, Nov 16, 2024 at 05:55:03PM +0900, Joe Hattori wrote:
> The refcounts of the OF nodes obtained in by of_get_child_by_name()
> calls in anx7411_typec_switch_probe() are not decremented, so add
> fwnode_handle_put() calls to anx7411_unregister_switch() and
> anx7411_unregister_mux().
>
> Fixes: e45d7337dc0e ("usb: typec: anx7411: Use of_get_child_by_name() instead of of_find_node_by_name()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
> ---
> Changed in v2:
> - Add the Cc: stable@vger.kernel.org tag.
> ---
> drivers/usb/typec/anx7411.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/typec/anx7411.c b/drivers/usb/typec/anx7411.c
> index cdb7e8273823..d3c5d8f410ca 100644
> --- a/drivers/usb/typec/anx7411.c
> +++ b/drivers/usb/typec/anx7411.c
> @@ -29,6 +29,8 @@
> #include <linux/workqueue.h>
> #include <linux/power_supply.h>
>
> +#include "mux.h"
This should not be necessary.
> #define TCPC_ADDRESS1 0x58
> #define TCPC_ADDRESS2 0x56
> #define TCPC_ADDRESS3 0x54
> @@ -1094,6 +1096,7 @@ static void anx7411_unregister_mux(struct anx7411_data *ctx)
> {
> if (ctx->typec.typec_mux) {
> typec_mux_unregister(ctx->typec.typec_mux);
> + fwnode_handle_put(ctx->typec.typec_mux->dev.fwnode);
> ctx->typec.typec_mux = NULL;
> }
> }
> @@ -1102,6 +1105,7 @@ static void anx7411_unregister_switch(struct anx7411_data *ctx)
> {
> if (ctx->typec.typec_switch) {
> typec_switch_unregister(ctx->typec.typec_switch);
> + fwnode_handle_put(ctx->typec.typec_switch->dev.fwnode);
> ctx->typec.typec_switch = NULL;
> }
> }
Instead of accessing the fwnode like that, add members for them to
anx7411_data.
thanks,
--
heikki
prev parent reply other threads:[~2024-11-19 15:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-16 8:55 [PATCH v2] usb: typec: anx7411: fix OF node reference leaks in anx7411_typec_switch_probe() Joe Hattori
2024-11-19 15:40 ` Heikki Krogerus [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZzyxV6xoMjgIEACe@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@pf.is.s.u-tokyo.ac.jp \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.