Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaib...@huawei.com>
---
 drivers/rtc/rtc-zynqmp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c
index 2c76275..55646e0 100644
--- a/drivers/rtc/rtc-zynqmp.c
+++ b/drivers/rtc/rtc-zynqmp.c
@@ -195,7 +195,6 @@ static irqreturn_t xlnx_rtc_interrupt(int irq, void *id)
 static int xlnx_rtc_probe(struct platform_device *pdev)
 {
        struct xlnx_rtc_dev *xrtcdev;
-       struct resource *res;
        int ret;
 
        xrtcdev = devm_kzalloc(&pdev->dev, sizeof(*xrtcdev), GFP_KERNEL);
@@ -211,9 +210,7 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
        xrtcdev->rtc->ops = &xlnx_rtc_ops;
        xrtcdev->rtc->range_max = U32_MAX;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-
-       xrtcdev->reg_base = devm_ioremap_resource(&pdev->dev, res);
+       xrtcdev->reg_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(xrtcdev->reg_base))
                return PTR_ERR(xrtcdev->reg_base);
 
-- 
2.7.4


Reply via email to