Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp279522yba; Sat, 13 Apr 2019 00:22:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4kivmdOfTDVA95DCaLPJQrOW29SDe2mP18svmVWQFCyBuUbtDFfWI8fynQ31RNp6WTO2u X-Received: by 2002:a17:902:e182:: with SMTP id cd2mr63003056plb.240.1555140179642; Sat, 13 Apr 2019 00:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555140179; cv=none; d=google.com; s=arc-20160816; b=FFtnV5X4io+PgnSr/+8ldwRQ47hJyQB7GbQ8ETSylTrOFt0/xToILDpkPZn1jtpx73 8x6qa/x1eWCqyHnK1juISmwxUeJlit41OJx/vfWhTiGa0bnX0tDOEykwWBoGDF11K5aP mdSRiPCkhFHruNd1gRq0zzQugSK2QbqaogCbxecLUIplD8dMNhE0bb65hXiBu5ttZYPD 8YHxYnERNgNRv6cwg1R4VNf9VF3CS4QgO3vksNMEJcgFrSpxDL4dNAqS6ZrdnJ5e2eB4 UatACofNFbhCFA/3wmZDuFe5bCHjCginLY3Tq+J8Mk3POCj1OoO2567B8UAeRjm2QuWq 45pQ== 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=m3k6vLsAPcyYqtw2N6NBUwZhQ9ADiHPY4IWgLpIdZiA=; b=cqrJ1A9PCYVY8O9aM9Nx0hB/Rss7fIGHXgMP9tchVBpJ/T8ASCXZFm1EesRvVr3AJ1 ScAZsAPoyC4zsbUjAvom8kgZkLCt4i97MzmNTbrjU0W0SjdxT/yH6VgaC5GTd4MIhpMH +u42Bmg/GHEFynYHTMS9iOXtUrm610kECvR+dX/jilqru2rHb97oOp6x0hpq+QffRE+x YjZ9cNel/J8XXhPJqOLIoqbfxeFC7MXVQPujgg/Rd2E/6d+U23I7u1/Qy9eCyPC8NXOc CAdkjidsiMrAd8NR14dVwypKMwR5rp2LDXp8K1T6I0wc0GZaOF9yJwOK/DMZbH3j8BmV mGSA== 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 d23si38760449pls.151.2019.04.13.00.22.44; Sat, 13 Apr 2019 00:22:59 -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 S1727381AbfDMHVr (ORCPT + 99 others); Sat, 13 Apr 2019 03:21:47 -0400 Received: from www.osadl.org ([62.245.132.105]:36455 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727342AbfDMHVr (ORCPT ); Sat, 13 Apr 2019 03:21:47 -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 x3D7JfAT003435; Sat, 13 Apr 2019 09:20:08 +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/4 RFC] ARM: imx legacy: warn on failed allocation Date: Sat, 13 Apr 2019 09:14:17 +0200 Message-Id: <1555139666-948-6-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 Even in init the allocation can fail and thus should at least warn so that the cause can be identified. Signed-off-by: Nicholas Mc Guire --- Problem located with an experimental coccinelle script Note sure if there is a better solution as this is early in the boot process so not that could be done anyway but fuss - anyway unchecked allocation is not a good thing. Patch was compile-tested with: imx_v4_v5_defconfig (implies CONFIG_MACH_MX27ADS=y) (with some unrelated sparse warnings about unimplemented syscalls and a few checkpatch warnings - covered in the other patches) Patch is against 5.1-rc4 (localversion-next is 20190412) arch/arm/mach-imx/mach-mx27ads.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c index 6dd7f57..528846f 100644 --- a/arch/arm/mach-imx/mach-mx27ads.c +++ b/arch/arm/mach-imx/mach-mx27ads.c @@ -247,6 +247,7 @@ static void __init mx27ads_regulator_init(void) struct gpio_chip *vchip; vchip = kzalloc(sizeof(*vchip), GFP_KERNEL); + WARN_ON(!vchip); vchip->owner = THIS_MODULE; vchip->label = "LCD"; vchip->base = MX27ADS_LCD_GPIO; -- 2.1.4