From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Wed, 18 Sep 2019 22:00:14 +0200

Simplify this function implementation by using a known wrapper function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 drivers/tty/serial/8250/8250_bcm2835aux.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c 
b/drivers/tty/serial/8250/8250_bcm2835aux.c
index 8ce700c1a7fc..e2c9d19fc8e9 100644
--- a/drivers/tty/serial/8250/8250_bcm2835aux.c
+++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
@@ -25,7 +25,6 @@ struct bcm2835aux_data {
 static int bcm2835aux_serial_probe(struct platform_device *pdev)
 {
        struct bcm2835aux_data *data;
-       struct resource *res;
        int ret;

        /* allocate the custom structure */
@@ -61,12 +60,7 @@ static int bcm2835aux_serial_probe(struct platform_device 
*pdev)
        data->uart.port.irq = ret;

        /* map the main registers */
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               dev_err(&pdev->dev, "memory resource not found");
-               return -EINVAL;
-       }
-       data->uart.port.membase = devm_ioremap_resource(&pdev->dev, res);
+       data->uart.port.membase = devm_platform_ioremap_resource(pdev, 0);
        ret = PTR_ERR_OR_ZERO(data->uart.port.membase);
        if (ret)
                return ret;
--
2.23.0

Reply via email to