Skip to content

Commit 6ab9810

Browse files
Shubhrajyoti Dattabebarino
authored andcommitted
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 <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/20220518055314.2486-1-shubhrajyoti.datta@xilinx.com Acked-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent acc1c73 commit 6ab9810

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/clk/zynqmp/divider.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,13 @@ static void zynqmp_get_divider2_val(struct clk_hw *hw,
120120
long error = LONG_MAX;
121121
unsigned long div1_prate;
122122
struct clk_hw *div1_parent_hw;
123+
struct zynqmp_clk_divider *pdivider;
123124
struct clk_hw *div2_parent_hw = clk_hw_get_parent(hw);
124-
struct zynqmp_clk_divider *pdivider =
125-
to_zynqmp_clk_divider(div2_parent_hw);
126125

126+
if (!div2_parent_hw)
127+
return;
128+
129+
pdivider = to_zynqmp_clk_divider(div2_parent_hw);
127130
if (!pdivider)
128131
return;
129132

0 commit comments

Comments
 (0)