Home Home > GIT Browse > SLE12-SP4
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMian Yousaf Kaukab <yousaf.kaukab@suse.com>2019-08-08 12:22:02 +0200
committerMian Yousaf Kaukab <yousaf.kaukab@suse.com>2019-08-08 12:22:14 +0200
commitfed12a173a71da39bde62da34a7bfad21b33f784 (patch)
tree0a9ef93e9aa71aba84464e23b0f6144ef7900ad3
parentb32563f6337e7799fbb33dcd71c73025df804ec7 (diff)
soc: rockchip: power-domain: Add a sanity check on pd->num_clks
(bsc#1144718,bsc#1144813).
-rw-r--r--patches.drivers/0004-soc-rockchip-power-domain-Add-a-sanity-check-on-pd-n.patch52
-rw-r--r--series.conf1
2 files changed, 53 insertions, 0 deletions
diff --git a/patches.drivers/0004-soc-rockchip-power-domain-Add-a-sanity-check-on-pd-n.patch b/patches.drivers/0004-soc-rockchip-power-domain-Add-a-sanity-check-on-pd-n.patch
new file mode 100644
index 0000000000..705389b784
--- /dev/null
+++ b/patches.drivers/0004-soc-rockchip-power-domain-Add-a-sanity-check-on-pd-n.patch
@@ -0,0 +1,52 @@
+From: Jeffy Chen <jeffy.chen@rock-chips.com>
+Date: Mon, 5 Mar 2018 17:17:22 +0800
+Subject: soc: rockchip: power-domain: Add a sanity check on pd->num_clks
+
+Git-commit: b1271993aa3855bda5073c6061a095fd6e6febc6
+Patch-mainline: v4.17-rc1
+References: bsc#1144718,bsc#1144813
+
+The of_count_phandle_with_args() can fail and return error(for example,
+rk3399 pd_vio doesn't have clocks). That would break the pd probe.
+
+Add a sanity check on pd->num_clks to avoid that.
+
+Fixes: 65084121d59d ("soc: rockchip: power-domain: use clk_bulk APIs")
+Reported-by: Shawn Lin <shawn.lin@rock-chips.com>
+Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
+Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
+Signed-off-by: Heiko Stuebner <heiko@sntech.de>
+Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
+---
+ drivers/soc/rockchip/pm_domains.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
+index ad96ddeaeb78..53efc386b1ad 100644
+--- a/drivers/soc/rockchip/pm_domains.c
++++ b/drivers/soc/rockchip/pm_domains.c
+@@ -402,11 +402,16 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
+
+ pd->num_clks = of_count_phandle_with_args(node, "clocks",
+ "#clock-cells");
+-
+- pd->clks = devm_kcalloc(pmu->dev, pd->num_clks, sizeof(*pd->clks),
+- GFP_KERNEL);
+- if (!pd->clks)
+- return -ENOMEM;
++ if (pd->num_clks > 0) {
++ pd->clks = devm_kcalloc(pmu->dev, pd->num_clks,
++ sizeof(*pd->clks), GFP_KERNEL);
++ if (!pd->clks)
++ return -ENOMEM;
++ } else {
++ dev_dbg(pmu->dev, "%s: doesn't have clocks: %d\n",
++ node->name, pd->num_clks);
++ pd->num_clks = 0;
++ }
+
+ for (i = 0; i < pd->num_clks; i++) {
+ pd->clks[i].clk = of_clk_get(node, i);
+--
+2.11.0
+
diff --git a/series.conf b/series.conf
index 602e841c71..0922f564ab 100644
--- a/series.conf
+++ b/series.conf
@@ -15333,6 +15333,7 @@
patches.drivers/dt-bindings-arm-document-soc-compatible-value-for-armadillo-800-eva.patch
patches.drivers/soc-qcom-wcnss_ctrl-Fix-increment-in-NV-upload
patches.drivers/0003-soc-rockchip-power-domain-use-clk_bulk-APIs.patch
+ patches.drivers/0004-soc-rockchip-power-domain-Add-a-sanity-check-on-pd-n.patch
patches.suse/0202-dm-crypt-limit-the-number-of-allocated-pages.patch
patches.suse/0203-dm-remove-unused-macro-DM_MOD_NAME_SIZE.patch
patches.suse/0204-dm-integrity-fail-early-if-required-HMAC-key-is-not-.patch