ARM: mach-hisi: Hisilicon SoC updates for 4.19

- check of_iomap and add missing of_node_put since of_find_compatible_node
   is invoked on hisilicon SoCs like hip01, hix5hd2 and hi3xxx.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJbT1kyAAoJEAvIV27ZiWZcFdcP/2dd0YBj26g6RUf0emNFSATZ
 8FOWQEnpq1DsWU/DWmBflhwIfTwHE9xdQfSJzCfgo422RlTM0ZC0dx5LCLDybfK/
 Lp5gfxFX0eq4RHKEjZ9+Lf8RFXzkHLM7UiubK1P/MOJOTfCjib/0oLZpDxM3KH+d
 GWQirqnLspLvZ62QFGVc6mex7NtxHZBymyItk2MV2hDkwnEqJzloBYKLBRa3zh5I
 amzuYQoPC3FAeNuNn1C4xMtBhWYH9FZaC1crnXXWus5KQ+t+3NTViryVWYRN0rjo
 nOMfjBYzOx/ZuzRLxSL4fH62hFkUcVy2+B80BVEf5mab/5aKmumk8NegUrpyXTyn
 tBNTAkD0guLNYedLE9o7TwE+HVc4EkHh2OCDlSyreF3A8VgYMSVzptlc3bQj90mR
 iuvsfNDypvCw85r58R+hKbbXX5VPWUh2P7QabzBlslV5aeQtZfiFuea6zsYeLJez
 I5yePdhTv+93iF3Wrt3Nk2TAZtQ1ksjmw06I3vBYxt/q46ZBFo1Ofs3pDynpHULj
 ccqA6XbD0a4zKUnzzbg48gWXCqccBSCwZafPpjjelh2ApXO0XuYU9W2Ake8BG/78
 0aL+DnU045amlwA1TLW2UtDcGEYecFIhMQ7YNbwpblX6s3YOntfVy27Uv3fLuHkT
 Xgl4Yh6wj+NR2+uTI93W
 =Qq8S
 -----END PGP SIGNATURE-----

Merge tag 'hisi-armv7-soc-for-4.19' of git://github.com/hisilicon/linux-hisi into next/soc

ARM: mach-hisi: Hisilicon SoC updates for 4.19

- check of_iomap and add missing of_node_put since of_find_compatible_node
  is invoked on hisilicon SoCs like hip01, hix5hd2 and hi3xxx.

* tag 'hisi-armv7-soc-for-4.19' of git://github.com/hisilicon/linux-hisi:
  ARM: hisi: handle of_iomap and fix missing of_node_put
  ARM: hisi: check of_iomap and fix missing of_node_put
  ARM: hisi: fix error handling and missing of_node_put

Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
Olof Johansson 2018-07-21 14:16:18 -07:00
commit 484a033bf0
1 changed files with 26 additions and 15 deletions

View File

@ -148,13 +148,20 @@ static int hi3xxx_hotplug_init(void)
struct device_node *node;
node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
if (node) {
ctrl_base = of_iomap(node, 0);
id = HI3620_CTRL;
return 0;
if (!node) {
id = ERROR_CTRL;
return -ENOENT;
}
id = ERROR_CTRL;
return -ENOENT;
ctrl_base = of_iomap(node, 0);
of_node_put(node);
if (!ctrl_base) {
id = ERROR_CTRL;
return -ENOMEM;
}
id = HI3620_CTRL;
return 0;
}
void hi3xxx_set_cpu(int cpu, bool enable)
@ -173,11 +180,15 @@ static bool hix5hd2_hotplug_init(void)
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");
if (np) {
ctrl_base = of_iomap(np, 0);
return true;
}
return false;
if (!np)
return false;
ctrl_base = of_iomap(np, 0);
of_node_put(np);
if (!ctrl_base)
return false;
return true;
}
void hix5hd2_set_cpu(int cpu, bool enable)
@ -219,10 +230,10 @@ void hip01_set_cpu(int cpu, bool enable)
if (!ctrl_base) {
np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
if (np)
ctrl_base = of_iomap(np, 0);
else
BUG();
BUG_ON(!np);
ctrl_base = of_iomap(np, 0);
of_node_put(np);
BUG_ON(!ctrl_base);
}
if (enable) {