forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/arch/arm/mach-rockchip/platsmp.c
....@@ -1,16 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) 2013 MundoReader S.L.
34 * Author: Heiko Stuebner <heiko@sntech.de>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
145 */
156
167 #include <linux/delay.h>
....@@ -189,7 +180,7 @@
189180
190181 rsize = resource_size(&res);
191182 if (rsize < trampoline_sz) {
192
- pr_err("%s: reserved block with size 0x%x is to small for trampoline size 0x%x\n",
183
+ pr_err("%s: reserved block with size 0x%x is too small for trampoline size 0x%x\n",
193184 __func__, rsize, trampoline_sz);
194185 return -EINVAL;
195186 }
....@@ -245,6 +236,7 @@
245236 }
246237
247238 pmu_base = of_iomap(node, 0);
239
+ of_node_put(node);
248240 if (!pmu_base) {
249241 pr_err("%s: could not map pmu registers\n", __func__);
250242 return -ENOMEM;
....@@ -277,19 +269,25 @@
277269 sram_base_addr = of_iomap(node, 0);
278270 if (!sram_base_addr) {
279271 pr_err("%s: could not map sram registers\n", __func__);
272
+ of_node_put(node);
280273 return;
281274 }
282275
283
- if (has_pmu && rockchip_smp_prepare_pmu())
276
+ if (has_pmu && rockchip_smp_prepare_pmu()) {
277
+ of_node_put(node);
284278 return;
279
+ }
285280
286281 if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
287
- if (rockchip_smp_prepare_sram(node))
282
+ if (rockchip_smp_prepare_sram(node)) {
283
+ of_node_put(node);
288284 return;
285
+ }
289286
290287 /* enable the SCU power domain */
291288 pmu_set_power_domain(PMU_PWRDN_SCU, true);
292289
290
+ of_node_put(node);
293291 node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
294292 if (!node) {
295293 pr_err("%s: missing scu\n", __func__);
....@@ -299,6 +297,7 @@
299297 scu_base_addr = of_iomap(node, 0);
300298 if (!scu_base_addr) {
301299 pr_err("%s: could not map scu registers\n", __func__);
300
+ of_node_put(node);
302301 return;
303302 }
304303
....@@ -317,6 +316,7 @@
317316 asm ("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr));
318317 ncores = ((l2ctlr >> 24) & 0x3) + 1;
319318 }
319
+ of_node_put(node);
320320
321321 /* Make sure that all cores except the first are really off */
322322 for (i = 1; i < ncores; i++)