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: 10901697 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 A9C2914DB for ; Mon, 15 Apr 2019 23:38:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9460128885 for ; Mon, 15 Apr 2019 23:38:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80075289A2; Mon, 15 Apr 2019 23:38:09 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C19BB2899F for ; Mon, 15 Apr 2019 23:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbfDOXiH (ORCPT ); Mon, 15 Apr 2019 19:38:07 -0400 Received: from emh07.mail.saunalahti.fi ([62.142.5.117]:51526 "EHLO emh07.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbfDOXiH (ORCPT ); Mon, 15 Apr 2019 19:38:07 -0400 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Aaro Koskinen 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.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); }