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 <tdas@codeaurora.org>
This commit is contained in:
Taniya Das 2021-07-13 11:52:00 +05:30 committed by Mike Tipton
parent 66d30da10f
commit bad04e2e90

View File

@ -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);
}