ata: palmld: fix return value check in palmld_pata_probe()
authorYang Yingliang <yangyingliang@huawei.com>
Sat, 29 Oct 2022 07:49:31 +0000 (15:49 +0800)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Mon, 31 Oct 2022 11:28:05 +0000 (20:28 +0900)
If devm_platform_ioremap_resource() fails, it never return
NULL pointer, replace the check with IS_ERR().

Fixes: 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
drivers/ata/pata_palmld.c

index 400e65190904fd04868871df36491b36de53fa00..51caa2a427dd8052e20aeebda780c21d83c467df 100644 (file)
@@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
 
        /* remap drive's physical memory address */
        mem = devm_platform_ioremap_resource(pdev, 0);
-       if (!mem)
-               return -ENOMEM;
+       if (IS_ERR(mem))
+               return PTR_ERR(mem);
 
        /* request and activate power and reset GPIOs */
        lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);