memory: fsl-corenet-cf: Use helper function devm_platform_ioremap_resource()
authorLv Ruyi <lv.ruyi@zte.com.cn>
Mon, 18 Apr 2022 02:01:47 +0000 (02:01 +0000)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 19 Apr 2022 14:59:03 +0000 (16:59 +0200)
Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource() and devm_ioremap_resource() separately.Make the
code simpler without functional changes.

Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Link: https://lore.kernel.org/r/20220418020147.2556925-1-lv.ruyi@zte.com.cn
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/memory/fsl-corenet-cf.c

index f8ea592c9cb5be478ad7c8dff19d4882a704efc4..7fc9f57ae2787f7384ee8fc333b4daab000e685b 100644 (file)
@@ -172,7 +172,6 @@ out:
 static int ccf_probe(struct platform_device *pdev)
 {
        struct ccf_private *ccf;
-       struct resource *r;
        const struct of_device_id *match;
        u32 errinten;
        int ret, irq;
@@ -185,13 +184,7 @@ static int ccf_probe(struct platform_device *pdev)
        if (!ccf)
                return -ENOMEM;
 
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!r) {
-               dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
-               return -ENXIO;
-       }
-
-       ccf->regs = devm_ioremap_resource(&pdev->dev, r);
+       ccf->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(ccf->regs))
                return PTR_ERR(ccf->regs);