diff options
author | Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> | 2022-01-17 02:01:34 +0000 |
---|---|---|
committer | Damien Le Moal <damien.lemoal@opensource.wdc.com> | 2022-01-31 09:58:31 +0900 |
commit | 8818a5342cb499b6959e821bf64c854e6a06bc82 (patch) | |
tree | 580bdd6e25f8f05d0903c34a238d9468038c6bfd /drivers/ata | |
parent | 26291c54e111ff6ba87a164d85d4a4e134b7315c (diff) |
ata: pata_platform: Make use of platform_get_mem_or_io()
Make use of platform_get_mem_or_io() to simplify the code.
While at it, drop use of unlikely() from pata_platform_probe()
as it isn't a hotpath.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/pata_platform.c | 18 |
1 files changed, 6 insertions, 12 deletions
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 |