]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ptp: ptp_dte: use devm_platform_ioremap_resource() to simplify code
authorYueHaibing <yuehaibing@huawei.com>
Wed, 9 Oct 2019 15:03:25 +0000 (23:03 +0800)
committerJakub Kicinski <jakub.kicinski@netronome.com>
Thu, 10 Oct 2019 23:21:13 +0000 (16:21 -0700)
Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
drivers/ptp/ptp_dte.c

index 0dcfdc806f57c2eb475a7bfcce21d6eeba7b9ec0..82d31ba326907f69c0b0fe19e10e06bdd7672bdd 100644 (file)
@@ -240,14 +240,12 @@ static int ptp_dte_probe(struct platform_device *pdev)
 {
        struct ptp_dte *ptp_dte;
        struct device *dev = &pdev->dev;
-       struct resource *res;
 
        ptp_dte = devm_kzalloc(dev, sizeof(struct ptp_dte), GFP_KERNEL);
        if (!ptp_dte)
                return -ENOMEM;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       ptp_dte->regs = devm_ioremap_resource(dev, res);
+       ptp_dte->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(ptp_dte->regs))
                return PTR_ERR(ptp_dte->regs);