clk: sunxi: Use resource_size
authorVaishali Thakkar <vaishali.thakkar@oracle.com>
Mon, 11 Apr 2016 04:53:03 +0000 (10:23 +0530)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Thu, 21 Apr 2016 22:29:22 +0000 (00:29 +0200)
Use the function resource_size instaed of explicit computation.

Problem found using Coccinelle.

Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
drivers/clk/sunxi/clk-sun9i-mmc.c

index a9b1761..0c2dd02 100644 (file)
@@ -106,7 +106,7 @@ static int sun9i_a80_mmc_config_clk_probe(struct platform_device *pdev)
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        /* one clock/reset pair per word */
-       count = DIV_ROUND_UP((r->end - r->start + 1), SUN9I_MMC_WIDTH);
+       count = DIV_ROUND_UP((resource_size(r)), SUN9I_MMC_WIDTH);
        data->membase = devm_ioremap_resource(&pdev->dev, r);
        if (IS_ERR(data->membase))
                return PTR_ERR(data->membase);