| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2013 MundoReader S.L. |
|---|
| 3 | 4 | * 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. |
|---|
| 14 | 5 | */ |
|---|
| 15 | 6 | |
|---|
| 16 | 7 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 189 | 180 | |
|---|
| 190 | 181 | rsize = resource_size(&res); |
|---|
| 191 | 182 | 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", |
|---|
| 193 | 184 | __func__, rsize, trampoline_sz); |
|---|
| 194 | 185 | return -EINVAL; |
|---|
| 195 | 186 | } |
|---|
| .. | .. |
|---|
| 245 | 236 | } |
|---|
| 246 | 237 | |
|---|
| 247 | 238 | pmu_base = of_iomap(node, 0); |
|---|
| 239 | + of_node_put(node); |
|---|
| 248 | 240 | if (!pmu_base) { |
|---|
| 249 | 241 | pr_err("%s: could not map pmu registers\n", __func__); |
|---|
| 250 | 242 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 277 | 269 | sram_base_addr = of_iomap(node, 0); |
|---|
| 278 | 270 | if (!sram_base_addr) { |
|---|
| 279 | 271 | pr_err("%s: could not map sram registers\n", __func__); |
|---|
| 272 | + of_node_put(node); |
|---|
| 280 | 273 | return; |
|---|
| 281 | 274 | } |
|---|
| 282 | 275 | |
|---|
| 283 | | - if (has_pmu && rockchip_smp_prepare_pmu()) |
|---|
| 276 | + if (has_pmu && rockchip_smp_prepare_pmu()) { |
|---|
| 277 | + of_node_put(node); |
|---|
| 284 | 278 | return; |
|---|
| 279 | + } |
|---|
| 285 | 280 | |
|---|
| 286 | 281 | 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); |
|---|
| 288 | 284 | return; |
|---|
| 285 | + } |
|---|
| 289 | 286 | |
|---|
| 290 | 287 | /* enable the SCU power domain */ |
|---|
| 291 | 288 | pmu_set_power_domain(PMU_PWRDN_SCU, true); |
|---|
| 292 | 289 | |
|---|
| 290 | + of_node_put(node); |
|---|
| 293 | 291 | node = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); |
|---|
| 294 | 292 | if (!node) { |
|---|
| 295 | 293 | pr_err("%s: missing scu\n", __func__); |
|---|
| .. | .. |
|---|
| 299 | 297 | scu_base_addr = of_iomap(node, 0); |
|---|
| 300 | 298 | if (!scu_base_addr) { |
|---|
| 301 | 299 | pr_err("%s: could not map scu registers\n", __func__); |
|---|
| 300 | + of_node_put(node); |
|---|
| 302 | 301 | return; |
|---|
| 303 | 302 | } |
|---|
| 304 | 303 | |
|---|
| .. | .. |
|---|
| 317 | 316 | asm ("mrc p15, 1, %0, c9, c0, 2\n" : "=r" (l2ctlr)); |
|---|
| 318 | 317 | ncores = ((l2ctlr >> 24) & 0x3) + 1; |
|---|
| 319 | 318 | } |
|---|
| 319 | + of_node_put(node); |
|---|
| 320 | 320 | |
|---|
| 321 | 321 | /* Make sure that all cores except the first are really off */ |
|---|
| 322 | 322 | for (i = 1; i < ncores; i++) |
|---|