From 5078963db49d263d50ef797cf44f6d0e4a026860 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 9fc95cf85c6c..43c772826b18 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -247,7 +247,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) { @@ -265,7 +266,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); }