aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShubhrajyoti Datta <[email protected]>2022-05-18 11:23:14 +0530
committerStephen Boyd <[email protected]>2022-08-22 17:01:05 -0700
commit6ab9810cfe6c8f3d8b8750c827d7870abd3751b9 (patch)
tree7648467be1fec8e5fe1ca657a30755982e36d678
parentacc1c732f35bb3a26177e54cd3de27e3524426e4 (diff)
clk: zynqmp: Add a check for NULL pointer
Add a NULL pointer check as clk_hw_get_parent can return NULL. Signed-off-by: Shubhrajyoti Datta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Michal Simek <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
-rw-r--r--drivers/clk/zynqmp/divider.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
index 05788d8325d4..33a3b2a22659 100644
--- a/drivers/clk/zynqmp/divider.c
+++ b/drivers/clk/zynqmp/divider.c
@@ -120,10 +120,13 @@ static void zynqmp_get_divider2_val(struct clk_hw *hw,
long error = LONG_MAX;
unsigned long div1_prate;
struct clk_hw *div1_parent_hw;
+ struct zynqmp_clk_divider *pdivider;
struct clk_hw *div2_parent_hw = clk_hw_get_parent(hw);
- struct zynqmp_clk_divider *pdivider =
- to_zynqmp_clk_divider(div2_parent_hw);
+ if (!div2_parent_hw)
+ return;
+
+ pdivider = to_zynqmp_clk_divider(div2_parent_hw);
if (!pdivider)
return;