ARM: OMAP1: ams-delta: fix early boot crash when LED support is disabled
authorAaro Koskinen <aaro.koskinen@iki.fi>
Mon, 15 Apr 2019 23:37:32 +0000 (02:37 +0300)
committerTony Lindgren <tony@atomide.com>
Tue, 16 Apr 2019 14:43:19 +0000 (07:43 -0700)
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 <aaro.koskinen@iki.fi>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap1/board-ams-delta.c

index 1b15d593837ed78ea22298ccc4ae60cb3de166f1..b6e814166ee03615bbda86dfd039e0fda021d502 100644 (file)
@@ -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);
        }