From: Rajendra Nayak <rnayak@codeaurora.org>
To: sboyd@codeaurora.org, mturquette@baylibre.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Rajendra Nayak <rnayak@codeaurora.org>
Subject: [PATCH] clk: Free struct clk allocated during clk_hw_register()
Date: Tue, 8 Nov 2016 13:53:50 +0530 [thread overview]
Message-ID: <1478593430-23102-1-git-send-email-rnayak@codeaurora.org> (raw)
With clk_hw_register() API we hide the struct clk from the caller
and return an int error code instead, so the caller (clk provider)
is not expected to use hw->clk on return.
Free the memory, and mark hw->clk as NULL before returning.
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
drivers/clk/clk.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 0fb39fe..f81e4aa 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2628,7 +2628,15 @@ struct clk *clk_register(struct device *dev, struct clk_hw *hw)
*/
int clk_hw_register(struct device *dev, struct clk_hw *hw)
{
- return PTR_ERR_OR_ZERO(clk_register(dev, hw));
+ struct clk *c;
+
+ c = clk_register(dev, hw);
+ if (IS_ERR(c))
+ return PTR_ERR(c);
+
+ __clk_free_clk(c);
+ hw->clk = NULL;
+ return 0;
}
EXPORT_SYMBOL_GPL(clk_hw_register);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
next reply other threads:[~2016-11-08 8:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-08 8:23 Rajendra Nayak [this message]
2016-11-08 9:36 ` Geert Uytterhoeven
2016-11-08 10:04 ` Rajendra Nayak
2016-11-08 10:37 ` Rajendra Nayak
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=1478593430-23102-1-git-send-email-rnayak@codeaurora.org \
--to=rnayak@codeaurora.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.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
Powered by JetHome