From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Prashant Malani <pmalani@chromium.org>, linux-kernel@vger.kernel.org
Cc: Benson Leung <bleung@chromium.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Guenter Roeck <groeck@chromium.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH v2 1/1] platform/chrome: cros_ec_typec: Put fwnode in error case during ->probe()
Date: Wed, 16 Jun 2021 00:51:11 +0300 [thread overview]
Message-ID: <20210615215111.377348-1-andy.shevchenko@gmail.com> (raw)
device_for_each_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.
Fixes: fdc6b21e2444 ("platform/chrome: Add Type C connector class driver")
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Prashant Malani <pmalani@chromium.org>
---
v2: added comment (Prashant), added Rb tag (Prashant)
drivers/platform/chrome/cros_ec_typec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 27c068c4c38d..99fdc1156392 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -375,6 +375,8 @@ static int cros_typec_init_ports(struct cros_typec_data *typec)
return 0;
unregister_ports:
+ /* Drop the referece that bumped by device_for_each_child_node() */
+ fwnode_handle_put(fwnode);
cros_unregister_ports(typec);
return ret;
}
--
2.32.0
reply other threads:[~2021-06-15 21:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210615215111.377348-1-andy.shevchenko@gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=bleung@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmalani@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).