Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lad Prabhakar and committed by
Damien Le Moal
8818a534 26291c54

+6 -12
+6 -12
drivers/ata/pata_platform.c
··· 200 200 /* 201 201 * Get the I/O base first 202 202 */ 203 - io_res = platform_get_resource(pdev, IORESOURCE_IO, 0); 204 - if (io_res == NULL) { 205 - io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 206 - if (unlikely(io_res == NULL)) 207 - return -EINVAL; 208 - } 203 + io_res = platform_get_mem_or_io(pdev, 0); 204 + if (!io_res) 205 + return -EINVAL; 209 206 210 207 /* 211 208 * Then the CTL base 212 209 */ 213 - ctl_res = platform_get_resource(pdev, IORESOURCE_IO, 1); 214 - if (ctl_res == NULL) { 215 - ctl_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 216 - if (unlikely(ctl_res == NULL)) 217 - return -EINVAL; 218 - } 210 + ctl_res = platform_get_mem_or_io(pdev, 1); 211 + if (!ctl_res) 212 + return -EINVAL; 219 213 220 214 /* 221 215 * And the IRQ