From patchwork Mon Apr 15 23:37:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaro Koskinen X-Patchwork-Id: 10901699 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EFAD814DB for ; Mon, 15 Apr 2019 23:38:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46B4287AF for ; Mon, 15 Apr 2019 23:38:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C8BD0288EE; Mon, 15 Apr 2019 23:38:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 64934287AF for ; Mon, 15 Apr 2019 23:38:19 +0000 (UTC) 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: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:In-Reply-To: References:List-Owner; bh=Oasi5HE+x1ZKxJfJhN5adP+6JWQSS1YbrfPJBQy+lBU=; b=jPC 5ubTW3g/ZgOmhrEmdW9UiVuJNxQqviRxCqoyGDpjQzVc8cyKQFqXLVKNv5OaUG8q7CLHwLBpGBgzf RZpkDvwbSMEELIfsb1d2bqZf20qeyp6318pec+BsUVKveJvjcKr0jDoyGcZOyVjRLExe1+b3MasZC 1oU2fKL68oQcf5Pg1cq/USUzi3uNiDMii/919Mj+BOItsw4g7BpNXBOmrhHvfB9TELaqBNLPn15FH GxSnKX8AI6HwdRu4HpjyMBp/tJePLHBjZ54i3xNMhQhFo76Sy+mySxyur/5R3EoY0wRLc1lSNb/6w twBMKNt9rIttBmHUMCiMHMRyTR6hycQ==; 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 1hGBAz-0005yh-Cb; Mon, 15 Apr 2019 23:38:13 +0000 Received: from emh07.mail.saunalahti.fi ([62.142.5.117]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hGBAv-0005yK-Ag for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 23:38:11 +0000 Received: from localhost.localdomain (85-76-110-185-nat.elisa-mobile.fi [85.76.110.185]) by emh07.mail.saunalahti.fi (Postfix) with ESMTP id 132E5B004D; Tue, 16 Apr 2019 02:38:04 +0300 (EEST) From: Aaro Koskinen To: Tony Lindgren , linux-omap@vger.kernel.org, Janusz Krzysztofik , Pavel Machek , Linus Walleij Subject: [PATCH] ARM: OMAP1: ams-delta: fix early boot crash when LED support is disabled Date: Tue, 16 Apr 2019 02:37:32 +0300 Message-Id: <20190415233732.3612-1-aaro.koskinen@iki.fi> X-Mailer: git-send-email 2.17.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_163809_539326_724213AC X-CRM114-Status: GOOD ( 10.33 ) 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: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aaro Koskinen MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When we boot with the LED support (CONFIG_NEW_LEDS) disabled, gpio_led_register_device() will return a NULL pointer and we try to dereference it. Fix by checking also for a NULL pointer. Fixes: 19a2668a8ae3 ("ARM: OMAP1: ams-delta: Provide GPIO lookup table for LED device") Signed-off-by: Aaro Koskinen Acked-by: Pavel Machek --- arch/arm/mach-omap1/board-ams-delta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index c4c0a8ea11e4..2b3d1197bb19 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c @@ -749,7 +749,7 @@ static void __init ams_delta_init(void) ARRAY_SIZE(ams_delta_gpio_tables)); leds_pdev = gpio_led_register_device(PLATFORM_DEVID_NONE, &leds_pdata); - if (!IS_ERR(leds_pdev)) { + if (!IS_ERR_OR_NULL(leds_pdev)) { leds_gpio_table.dev_id = dev_name(&leds_pdev->dev); gpiod_add_lookup_table(&leds_gpio_table); }