public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Liang He <windhl@126.com>
To: peda@axentia.se, linux-i2c@vger.kernel.org, windhl@126.com
Subject: [PATCH v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop
Date: Fri, 22 Jul 2022 09:24:01 +0800	[thread overview]
Message-ID: <20220722012401.1303609-1-windhl@126.com> (raw)

In i2c_mux_probe(), we should call of_node_put() when breaking out
of for_each_child_of_node() which will automatically increase and
decrease the refcount.

Fixes: ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver")
Signed-off-by: Liang He <windhl@126.com>
---
 changelog:

 v2: make a correct patch pointed out by Peter 
 v1: https://lore.kernel.org/all/20220721081202.1300071-1-windhl@126.com/

 drivers/i2c/muxes/i2c-mux-gpmux.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-gpmux.c
index d3acd8d66c32..33024acaac02 100644
--- a/drivers/i2c/muxes/i2c-mux-gpmux.c
+++ b/drivers/i2c/muxes/i2c-mux-gpmux.c
@@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev)
 	return 0;
 
 err_children:
+	of_node_put(child);
 	i2c_mux_del_adapters(muxc);
 err_parent:
 	i2c_put_adapter(parent);
-- 
2.25.1


             reply	other threads:[~2022-07-22  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22  1:24 Liang He [this message]
2022-07-25 21:38 ` [PATCH v2] i2c: i2c-mux-gpmux: Add of_node_put() when breaking out of loop Peter Rosin

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=20220722012401.1303609-1-windhl@126.com \
    --to=windhl@126.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peda@axentia.se \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox