clk: qcom: Fix accessing of clks element during the probe

There is access to platform descriptor clks init.name without
checking, whether clks is present or not. This is leading to
kernel crash during the device bootup. Move the init.name
access after checking whether clks is valid or not.

Change-Id: I7b27e5103822d6b2f499fb5f5e94ae9f9d4af34a
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
This commit is contained in:
Prasad Sodagudi 2020-01-14 11:06:16 -08:00
commit dbb563fda1

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/clk-provider.h>
@ -509,14 +509,14 @@ static int clk_rpmh_probe(struct platform_device *pdev)
hw_clks = desc->clks;
for (i = 0; i < desc->num_clks; i++) {
const char *name = hw_clks[i]->init->name;
const char *name;
u32 res_addr;
size_t aux_data_len;
const struct bcm_db *data;
if (!hw_clks[i])
continue;
name = hw_clks[i]->init->name;
rpmh_clk = to_clk_rpmh(hw_clks[i]);
res_addr = cmd_db_read_addr(rpmh_clk->res_name);
if (!res_addr) {