From: Chuhong Yuan <hslester96@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Daniel Kurtz <djkurtz@chromium.org>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Akshu Agrawal <Akshu.Agrawal@amd.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Chuhong Yuan <hslester96@gmail.com>
Subject: [PATCH] clk: clk-st: Add the missed checks in st_clk_probe()
Date: Wed, 3 Jun 2020 17:25:28 +0800 [thread overview]
Message-ID: <20200603092528.1424271-1-hslester96@gmail.com> (raw)
st_clk_probe() has not check for clk_hw_register_mux(), clk_hw_register_gate()
and devm_clk_hw_register_clkdev().
Add the missed checks and return devm_clk_hw_register_clkdev()'s return value
to check errors.
Fixes: 421bf6a1f061 ("clk: x86: Add ST oscout platform clock")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
drivers/clk/x86/clk-st.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/x86/clk-st.c b/drivers/clk/x86/clk-st.c
index 25d4b97aff9b..e6ee6ea2568b 100644
--- a/drivers/clk/x86/clk-st.c
+++ b/drivers/clk/x86/clk-st.c
@@ -46,16 +46,20 @@ static int st_clk_probe(struct platform_device *pdev)
clk_oscout1_parents, ARRAY_SIZE(clk_oscout1_parents),
0, st_data->base + CLKDRVSTR2, OSCOUT1CLK25MHZ, 3, 0, NULL);
+ if (IS_ERR(hws[ST_CLK_MUX]))
+ return PTR_ERR(hws[ST_CLK_MUX]);
+
clk_set_parent(hws[ST_CLK_MUX]->clk, hws[ST_CLK_48M]->clk);
hws[ST_CLK_GATE] = clk_hw_register_gate(NULL, "oscout1", "oscout1_mux",
0, st_data->base + MISCCLKCNTL1, OSCCLKENB,
CLK_GATE_SET_TO_DISABLE, NULL);
- devm_clk_hw_register_clkdev(&pdev->dev, hws[ST_CLK_GATE], "oscout1",
- NULL);
+ if (IS_ERR(hws[ST_CLK_GATE]))
+ return PTR_ERR(hws[ST_CLK_GATE]);
- return 0;
+ return devm_clk_hw_register_clkdev(&pdev->dev, hws[ST_CLK_GATE],
+ "oscout1", NULL);
}
static int st_clk_remove(struct platform_device *pdev)
--
2.26.2
reply other threads:[~2020-06-03 9:25 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=20200603092528.1424271-1-hslester96@gmail.com \
--to=hslester96@gmail.com \
--cc=Akshu.Agrawal@amd.com \
--cc=djkurtz@chromium.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=rafael.j.wysocki@intel.com \
--cc=sboyd@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 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).