From bad04e2e903dd33ec1f81971e1d9199901cc4e26 Mon Sep 17 00:00:00 2001 From: Taniya Das Date: Tue, 13 Jul 2021 11:52:00 +0530 Subject: [PATCH] clk: qcom: common: Check for rclks before access The critical devices or critical clocks where the clocks of the device node requires to be kept enabled should be checked for valid rclk before update. Thus check for NULL before accessing the rclk. Change-Id: Ie0cf1486f8cc422de8fce0241bd6e81fd9d7ca2b Signed-off-by: Taniya Das --- drivers/clk/qcom/common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 9e377dfaf05b..a45119c50b80 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -246,7 +246,8 @@ static void qcom_cc_set_critical(struct device *dev, struct qcom_cc *cc) if (i >= cc->num_rclks) continue; - cc->rclks[i]->flags |= QCOM_CLK_IS_CRITICAL; + if (cc->rclks[i]) + cc->rclks[i]->flags |= QCOM_CLK_IS_CRITICAL; } of_property_for_each_u32(dev->of_node, "qcom,critical-devices", prop, p, i) { @@ -264,7 +265,8 @@ static void qcom_cc_set_critical(struct device *dev, struct qcom_cc *cc) if (args.np != dev->of_node || clock_idx >= cc->num_rclks) continue; - cc->rclks[clock_idx]->flags |= QCOM_CLK_IS_CRITICAL; + if (cc->rclks[clock_idx]) + cc->rclks[clock_idx]->flags |= QCOM_CLK_IS_CRITICAL; of_node_put(args.np); }