From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A355C10F11 for ; Sat, 13 Apr 2019 07:30:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 305BA21721 for ; Sat, 13 Apr 2019 07:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727255AbfDMHaY (ORCPT ); Sat, 13 Apr 2019 03:30:24 -0400 Received: from www.osadl.org ([62.245.132.105]:36563 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727224AbfDMHaV (ORCPT ); Sat, 13 Apr 2019 03:30:21 -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 x3D7Sohc010572; Sat, 13 Apr 2019 09:28:56 +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:23:30 +0200 Message-Id: <1555140213-1081-2-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555140213-1081-1-git-send-email-hofrat@osadl.org> References: <1555140213-1081-1-git-send-email-hofrat@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA184C282CE for ; Sat, 13 Apr 2019 07:30:25 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 893E2218C3 for ; Sat, 13 Apr 2019 07:30:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l1BrSrew" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 893E2218C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=osadl.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qIudpkxij5GeJt5USJ0wfulfqF3xdCygTRC3IlUs1mU=; b=l1BrSrewnrs/fbH1hhxvMdRYXo 59BSW4ZhsbvTL8FDbJpE8nQZKWwKEdylWfqmc9fyRDxynuWyP7pqX1YUxjPQRN+rQ6KjByXlRAibG Gja+qbgSsH+OfaRG1OM17DV3LgCs0hWMIPCHoKT/q7zjV31M/EnASiV5gRLXlJKQjVmThaZdHOHBO vjLOSvQSyjCfjzMOMfDqkEFNJ6g3Vr+bH3l7wLcgAV8jLWbvrNC/q1N7dd6F9ZmYaWXC65IcfsdHg 6Jbj3mxE38XEcd82nM8PygzHebHzUBE+17xLmYFRHW01kOeLcmQHpPq4oxQWjxgZZYeire6mthn7y 3NLR3aUw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFD7G-0001n0-UJ; Sat, 13 Apr 2019 07:30:22 +0000 Received: from www.osadl.org ([2001:a60:9266:ffff:62:245:132:105]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hFD78-0001bi-Pq for linux-arm-kernel@lists.infradead.org; Sat, 13 Apr 2019 07:30:17 +0000 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 x3D7Sohc010572; Sat, 13 Apr 2019 09:28:56 +0200 From: Nicholas Mc Guire To: Russell King Subject: [PATCH 1/4 RFC] ARM: imx legacy: warn on failed allocation Date: Sat, 13 Apr 2019 09:23:30 +0200 Message-Id: <1555140213-1081-2-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1555140213-1081-1-git-send-email-hofrat@osadl.org> References: <1555140213-1081-1-git-send-email-hofrat@osadl.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190413_003015_372770_4EB39ABF X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mike Rapoport , Tony Lindgren , Shawn Guo , Sascha Hauer , Janusz Krzysztofik , linux-kernel@vger.kernel.org, Mark Brown , NXP Linux Team , Pengutronix Kernel Team , Nicholas Mc Guire , Fabio Estevam , Linus Walleij , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel