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

Commit f1b3eb07 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: npu: Check for npu bandwidth node before assignment"

parents 70cc234a 8606f531
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -1896,6 +1896,8 @@ static int npu_pwrctrl_init(struct npu_device *npu_dev)
	struct platform_device *p2dev;
	struct npu_pwrctrl *pwr = &npu_dev->pwrctrl;

	pwr->devbw_num = 0;

	/* Power levels */
	node = of_find_node_by_name(pdev->dev.of_node, "qcom,npu-pwrlevels");

@@ -1909,15 +1911,17 @@ static int npu_pwrctrl_init(struct npu_device *npu_dev)
		return ret;

	/* Parse Bandwidth Monitor */
	pwr->devbw_num = of_property_count_strings(pdev->dev.of_node,
	ret = of_property_count_strings(pdev->dev.of_node,
			"qcom,npubw-dev-names");
	if (pwr->devbw_num <= 0) {
	if (ret <= 0) {
		NPU_INFO("npubw-dev-names are not defined\n");
		return 0;
	} else if (pwr->devbw_num > NPU_MAX_BW_DEVS) {
		NPU_ERR("number of devbw %d exceeds limit\n", pwr->devbw_num);
	} else if (ret > NPU_MAX_BW_DEVS) {
		NPU_ERR("number of devbw %d exceeds limit\n", ret);
		return -EINVAL;
	}
	pwr->devbw_num = ret;
	ret = 0;

	for (i = 0; i < pwr->devbw_num; i++) {
		node = of_parse_phandle(pdev->dev.of_node,