Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4087542e authored by Yuanfang Zhang's avatar Yuanfang Zhang
Browse files

coresight: Update the logic for obtaining and enabling reg_clk



If the relevant property is not configured, of_property_count_strings()
will return a negative value, so the function of_coresight_get_reg_clk()
should directly return nul. In the function coresight_enable_reg_clk,
if reg_clk is NULL, it means that no reg_clk needs to be
enabled, the function should directly return 0.

Change-Id: I4f195b7c4701353fe61591f28e336f8bce55e43d
Signed-off-by: default avatarYuanfang Zhang <zhangyuanfang@codeaurora.org>
parent a9013b58
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2012, 2017-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012, 2017-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/kernel.h>
@@ -133,7 +133,10 @@ int coresight_enable_reg_clk(struct coresight_device *csdev)
	int ret;
	int i, j;

	if (IS_ERR_OR_NULL(reg_clk))
	if (!reg_clk)
		return 0;

	if (IS_ERR(reg_clk))
		return -EINVAL;

	for (i = 0; i < reg_clk->nr_reg; i++) {
+3 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2012,2017-2018 The Linux Foundation. All rights reserved.
 * Copyright (c) 2012,2017-2018,2020 The Linux Foundation. All rights reserved.
 */

#include <linux/types.h>
@@ -131,7 +131,8 @@ of_coresight_get_reg_clk(struct device *dev, const struct device_node *node)

	nr_reg = of_property_count_strings(node, "qcom,proxy-regs");
	nr_clk = of_property_count_strings(node, "qcom,proxy-clks");
	if (!nr_reg && !nr_clk)

	if (nr_reg <= 0 && nr_clk <= 0)
		return NULL;

	reg_clk = devm_kzalloc(dev, sizeof(*reg_clk), GFP_KERNEL);