Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp279026yba; Sat, 13 Apr 2019 00:21:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrUuXQ/UqgOa1TdfbUlX6FZL96bLzLoVJ5s6+yE60kMT/30wgNNqoImjv8We3m8mFVWTps X-Received: by 2002:a65:5682:: with SMTP id v2mr58862030pgs.100.1555140115707; Sat, 13 Apr 2019 00:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555140115; cv=none; d=google.com; s=arc-20160816; b=lL+w52SFlXCFUbtjsZbILsbYzQNSXB52vP4aRfR6EcGuq2gs9OMJ1G931kw0Vmt4Fs 5m8APrc5HnYQlI1cdRuT2GsK2kG/zCHwxWoXd8peU+L9w8Zyj69FZRQK/HfUS1jHX+CM lcDSPExO3D5gNHQyUAd+cpSsZOg0ovX/0pMYdWl/2yE7UKNPwIwvigBVMizoEMxl20aa JdPxT3c/x0MI85qV//WMKM//CvFIqBmS1XlrKHCVrL9FSzAf5Q1/Xf0S1AyH1P7SUBSX ibXEG1vO04gik8wY1yDW7/Xuk2l236kQ2XIt0UuqBZxV00Hu++8SbaoTSVJCqN1jc/72 fmww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=MHGABP5IAgyIX7oUUNjK/DbS+D0+LCOAgruBQVpPFtk=; b=0Oz+t06NBAWS3GplBeOqkvZd74WkmXmv6J5q6qLFvyMekkzF8LA2lHUlbFIfafx5xH wPPuEJ8PtaXk78Th+9IG4q1veE92Jxj1q1MM7T5wD0XPonzZFCjhcRZfXxypBRd5T8Wg I949a1XaXYHYOQDVoWoTy0LIGCwGpvEsXG65J+S0kldmIT+ls9Hu5uxPMb78ITe6jnIA DLRLUEbn/XbJVbF5NkBEiC5A4Pnmd72sN/ILbKdgKao4RzjOmQPltiCP+j2136DGfa+3 tNU7xWpmAAsknj9AnUZheP3pHM9p1Sz+PN06NpvPpEzmuHjwQpAA4sNoQQtfOnC9AFtO B42g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13si20852516pgp.569.2019.04.13.00.21.26; Sat, 13 Apr 2019 00:21:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727185AbfDMHUd (ORCPT + 99 others); Sat, 13 Apr 2019 03:20:33 -0400 Received: from www.osadl.org ([62.245.132.105]:36361 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726988AbfDMHU3 (ORCPT ); Sat, 13 Apr 2019 03:20:29 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id x3D7JfAR003435; Sat, 13 Apr 2019 09:19:58 +0200 From: Nicholas Mc Guire To: Russell King Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Mark Brown , Linus Walleij , Tony Lindgren , Mike Rapoport , Janusz Krzysztofik , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 1/3] ARM: hisi: fix error handling and missing of_node_put Date: Sat, 13 Apr 2019 09:14:15 +0200 Message-Id: <1555139666-948-4-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555139666-948-1-git-send-email-hofrat@osadl.org> References: <1555139666-948-1-git-send-email-hofrat@osadl.org> X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00,DATE_IN_FUTURE_96_Q, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") --- Problem located by experimental coccinelle script Patch was compile tested with: hisi_defconfig (implies CONFIG_SMP=y) There are two change related checkpatch warnings about "WARNING: Avoid crashing the kernel - try using WARN_ON" but here the BUG_ON() seems adequate. Patch is against 4.18-rc3 (localversion-next is next-20180712) 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 a129aae..3b0d1c6 100644 --- a/arch/arm/mach-hisi/hotplug.c +++ b/arch/arm/mach-hisi/hotplug.c @@ -219,10 +219,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) { -- 2.1.4