From 8abc5a7ce6e6a5b77f0ec82c91107a978b32f6e3 Mon Sep 17 00:00:00 2001 From: Wen Yang Date: Tue, 5 Mar 2019 19:33:53 +0800 Subject: ARM: bcm: fix a leaked reference by adding missing of_node_put The call to of_get_next_child returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./arch/arm/mach-bcm/board_bcm281xx.c:43:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 35, but without a corresponding object release within this function. ./arch/arm/mach-bcm/platsmp-brcmstb.c:337:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this function. ./arch/arm/mach-bcm/platsmp-brcmstb.c:341:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this functio ./arch/arm/mach-bcm/bcm63xx_smp.c:150:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function. Signed-off-by: Wen Yang Reviewed-by: Florian Fainelli Cc: Florian Fainelli Cc: Ray Jui Cc: Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: Brian Norris Cc: Gregory Fong Acked-by: Ray Jui Signed-off-by: Florian Fainelli --- arch/arm/mach-bcm/bcm63xx_smp.c | 1 + arch/arm/mach-bcm/board_bcm281xx.c | 1 + arch/arm/mach-bcm/platsmp-brcmstb.c | 7 +++++-- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'arch/arm/mach-bcm') diff --git a/arch/arm/mach-bcm/bcm63xx_smp.c b/arch/arm/mach-bcm/bcm63xx_smp.c index f5fb10b4376f..1cb4ce812a84 100644 --- a/arch/arm/mach-bcm/bcm63xx_smp.c +++ b/arch/arm/mach-bcm/bcm63xx_smp.c @@ -142,6 +142,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu, * return */ ret = bcm63xx_pmb_power_on_cpu(dn); + of_node_put(dn); if (ret) goto out; out: diff --git a/arch/arm/mach-bcm/board_bcm281xx.c b/arch/arm/mach-bcm/board_bcm281xx.c index b81bb386951d..1238ac801530 100644 --- a/arch/arm/mach-bcm/board_bcm281xx.c +++ b/arch/arm/mach-bcm/board_bcm281xx.c @@ -38,6 +38,7 @@ static void bcm281xx_restart(enum reboot_mode mode, const char *cmd) return; } base = of_iomap(np_wdog, 0); + of_node_put(np_wdog); if (!base) { pr_emerg("Couldn't map brcm,kona-wdt\n"); return; diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c index 12379960e982..4555f21e7077 100644 --- a/arch/arm/mach-bcm/platsmp-brcmstb.c +++ b/arch/arm/mach-bcm/platsmp-brcmstb.c @@ -334,11 +334,14 @@ static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus) rc = setup_hifcpubiuctrl_regs(np); if (rc) - return; + goto out_put_node; rc = setup_hifcont_regs(np); if (rc) - return; + goto out_put_node; + +out_put_node: + of_node_put(np); } static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle) -- cgit From 933b9609d33567804c1fd9de70c4ee34c43791c1 Mon Sep 17 00:00:00 2001 From: Jim Quinlan Date: Fri, 31 May 2019 10:27:03 -0700 Subject: ARM: bcm: Enable ARCH_HAS_RESET_CONTROLLER for ARCH_BRCMSTB Allow the use of reset controllers on ARCH_BRCMSTB such as the recently introduced RESET_BRCMSTB driver. Signed-off-by: Jim Quinlan Signed-off-by: Florian Fainelli --- arch/arm/mach-bcm/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/mach-bcm') diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig index 4ef1e55f4a0b..8d03b42d2b73 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig @@ -208,6 +208,7 @@ config ARCH_BCM_63XX config ARCH_BRCMSTB bool "Broadcom BCM7XXX based boards" depends on ARCH_MULTI_V7 + select ARCH_HAS_RESET_CONTROLLER select ARM_GIC select ARM_ERRATA_798181 if SMP select HAVE_ARM_ARCH_TIMER -- cgit From 885895a8eae60bfcb9fbc6b91b35c5b930834011 Mon Sep 17 00:00:00 2001 From: Doug Berger Date: Fri, 31 May 2019 10:31:29 -0700 Subject: ARM: bcm: Enable PINCTRL for ARCH_BRCMSTB ARCH_BRCMSTB needs to use the BCM2835 pin controller for chips like BCM7211 which adopted that pin controller for GPIO. Signed-off-by: Doug Berger Signed-off-by: Florian Fainelli --- arch/arm/mach-bcm/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/arm/mach-bcm') diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig index 8d03b42d2b73..5e5f1fabc3d4 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig @@ -218,6 +218,7 @@ config ARCH_BRCMSTB select ZONE_DMA if ARM_LPAE select SOC_BRCMSTB select SOC_BUS + select PINCTRL help Say Y if you intend to run the kernel on a Broadcom ARM-based STB chipset. -- cgit From 3fe1ee40b2a2db271513a498c475c13572dcb4c6 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 28 May 2019 00:40:50 +0200 Subject: ARM: use arch_extension directive instead of arch argument The LLVM Target parser currently does not allow to specify the security extension as part of -march (see also LLVM Bug 40186 [0]). When trying to use Clang with LLVM's integrated assembler, this leads to build errors such as this: clang-8: error: the clang compiler does not support '-Wa,-march=armv7-a+sec' Use ".arch_extension sec" to enable the security extension in a more portable fasion. Also make sure to use ".arch armv7-a" in case a v6/v7 multi-platform kernel is being built. Note that this is technically not exactly the same as the old code checked for availabilty of the security extension by calling as-instr. However, there are already other sites which use ".arch_extension sec" unconditionally, hence de-facto we need an assembler capable of ".arch_extension sec" already today (arch/arm/mm/proc-v7.S). The arch extension "sec" is available since binutils 2.21 according to its documentation [1]. [0] https://bugs.llvm.org/show_bug.cgi?id=40186 [1] https://sourceware.org/binutils/docs-2.21/as/ARM-Options.html Signed-off-by: Stefan Agner Acked-by: Mans Rullgard Acked-by: Arnd Bergmann Acked-by: Krzysztof Kozlowski Signed-off-by: Olof Johansson --- arch/arm/mach-bcm/Makefile | 3 --- arch/arm/mach-bcm/bcm_kona_smc.c | 2 -- 2 files changed, 5 deletions(-) (limited to 'arch/arm/mach-bcm') diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile index 8fd23b263c60..b59c813b1af4 100644 --- a/arch/arm/mach-bcm/Makefile +++ b/arch/arm/mach-bcm/Makefile @@ -40,9 +40,6 @@ obj-$(CONFIG_ARCH_BCM_MOBILE_L2_CACHE) += kona_l2_cache.o # Support for secure monitor traps obj-$(CONFIG_ARCH_BCM_MOBILE_SMC) += bcm_kona_smc.o -ifeq ($(call as-instr,.arch_extension sec,as_has_sec),as_has_sec) -CFLAGS_bcm_kona_smc.o += -Wa,-march=armv7-a+sec -DREQUIRES_SEC -endif # BCM2835 obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c index a55a7ecf146a..541e850a736c 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -125,9 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys) __asmeq("%2", "r4") __asmeq("%3", "r5") __asmeq("%4", "r6") -#ifdef REQUIRES_SEC ".arch_extension sec\n" -#endif " smc #0\n" : "=r" (ip), "=r" (r0) : "r" (r4), "r" (r5), "r" (r6) -- cgit