diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index 87c7c90676ca..21fb059859bd 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c @@ -200,22 +200,16 @@ static int pata_platform_probe(struct platform_device *pdev) /* * Get the I/O base first */ - io_res = platform_get_resource(pdev, IORESOURCE_IO, 0); - if (io_res == NULL) { - io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (unlikely(io_res == NULL)) - return -EINVAL; - } + io_res = platform_get_mem_or_io(pdev, 0); + if (!io_res) + return -EINVAL; /* * Then the CTL base */ - ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 1); - if (ctl_res == NULL) { - ctl_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (unlikely(ctl_res == NULL)) - return -EINVAL; - } + ctl_res = platform_get_mem_or_io(pdev, 1); + if (!ctl_res) + return -EINVAL; /* * And the IRQ