gpio_key: fix request gpio failed issue [1/1]
authorYingyuan Zhu <yingyuan.zhu@amlogic.com>
Mon, 29 Jul 2019 06:54:57 +0000 (14:54 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Thu, 1 Aug 2019 07:07:11 +0000 (00:07 -0700)
PD#SWPL-11929

Problem:
request gpio failed but the probe function continued
to execute successfully.

Solution:
add return value judgment.

Verify:
test pass on g12a

Change-Id: Iab04b8440a4ecb340d98baee7b1e0df5692739e7
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
drivers/amlogic/input/keyboard/gpio_keypad.c

index 04569b7..6b7abfe 100644 (file)
@@ -183,7 +183,7 @@ static int meson_gpio_kp_probe(struct platform_device *pdev)
        for (i = 0; i < keypad->key_size; i++) {
                //get all gpio desc.
                desc = devm_gpiod_get_index(&pdev->dev, "key", i, GPIOD_IN);
-               if (!desc)
+               if (IS_ERR_OR_NULL(desc))
                        return -EINVAL;
                keypad->key[i].desc = desc;
                //The gpio default is high level.