Input: ep93xx_keypad - use devm_platform_ioremap_resource() helper
authorLv Ruyi <lv.ruyi@zte.com.cn>
Wed, 20 Apr 2022 21:46:20 +0000 (14:46 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 25 Apr 2022 01:25:03 +0000 (18:25 -0700)
Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource() and devm_ioremap_resource() separately. This
makes the code simpler without functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20220418015036.2556731-1-lv.ruyi@zte.com.cn
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/keyboard/ep93xx_keypad.c

index 272a4f1c6e8191f44aa159ecd793c4b05043e567..7a3b0664ab4f47eab4acf4849ca1b94ba33faa74 100644 (file)
@@ -231,7 +231,6 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
        struct ep93xx_keypad *keypad;
        const struct matrix_keymap_data *keymap_data;
        struct input_dev *input_dev;
-       struct resource *res;
        int err;
 
        keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL);
@@ -250,11 +249,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
        if (keypad->irq < 0)
                return keypad->irq;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -ENXIO;
-
-       keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res);
+       keypad->mmio_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(keypad->mmio_base))
                return PTR_ERR(keypad->mmio_base);