From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr730091.outbound.protection.outlook.com ([40.107.73.91]:18669 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729852AbeIOGwZ (ORCPT ); Sat, 15 Sep 2018 02:52:25 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Nicholas Mc Guire , Wei Xu , Sasha Levin Subject: [PATCH AUTOSEL 4.4 07/20] ARM: hisi: fix error handling and missing of_node_put Date: Sat, 15 Sep 2018 01:35:09 +0000 Message-ID: <20180915013502.180110-7-alexander.levin@microsoft.com> References: <20180915013502.180110-1-alexander.levin@microsoft.com> In-Reply-To: <20180915013502.180110-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Nicholas Mc Guire [ Upstream commit 9f30b5ae0585ca5234fe979294b8f897299dec99 ] of_iomap() can return NULL which seems critical here and thus should be explicitly flagged so that the cause of system halting can be understood. As of_find_compatible_node() is returning a device node with refcount incremented it must be explicitly decremented here. Signed-off-by: Nicholas Mc Guire Fixes: commit 7fda91e73155 ("ARM: hisi: enable smp for HiP01") Signed-off-by: Wei Xu Signed-off-by: Sasha Levin --- arch/arm/mach-hisi/hotplug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-hisi/hotplug.c b/arch/arm/mach-hisi/hotplug.c index 3f28c9141b48..32870560b280 100644 --- a/arch/arm/mach-hisi/hotplug.c +++ b/arch/arm/mach-hisi/hotplug.c @@ -226,10 +226,10 @@ void hip01_set_cpu(int cpu, bool enable) =20 if (!ctrl_base) { np =3D of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl"); - if (np) - ctrl_base =3D of_iomap(np, 0); - else - BUG(); + BUG_ON(!np); + ctrl_base =3D of_iomap(np, 0); + of_node_put(np); + BUG_ON(!ctrl_base); } =20 if (enable) { --=20 2.17.1