* [PATCH v2] clk: clk-st: Add missed return value checks in st_clk_probe()
@ 2020-06-05 16:14 Chuhong Yuan
0 siblings, 0 replies; only message in thread
From: Chuhong Yuan @ 2020-06-05 16:14 UTC (permalink / raw)
Cc: Michael Turquette, Stephen Boyd, Markus Elfring, Akshu Agrawal,
Rafael J . Wysocki, Daniel Kurtz, linux-clk, linux-kernel,
Chuhong Yuan
Return values were not checked after calls of the following functions.
- clk_hw_register_mux
- clk_hw_register_gate
- devm_clk_hw_register_clkdev
Thus add error detection and the corresponding exception handling.
Return the value from the function call "devm_clk_hw_register_clkdev"
at the end of this function implementation.
Fixes: 421bf6a1f061 ("clk: x86: Add ST oscout platform clock")
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
Changes in v2:
- Modify description.
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-05 16:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05 16:14 [PATCH v2] clk: clk-st: Add missed return value checks in st_clk_probe() Chuhong Yuan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®