Skip to content

Commit 9a36e2d

Browse files
JiangJiaskuba-moo
authored andcommitted
octeon_ep: Add missing check for ioremap
Add check for ioremap() and return the error if it fails in order to guarantee the success of ioremap(). Fixes: 862cd65 ("octeon_ep: Add driver framework and device initialization") Signed-off-by: Jiasheng Jiang <[email protected]> Reviewed-by: Kalesh AP <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 76a4c8b commit 9a36e2d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,6 +981,9 @@ int octep_device_setup(struct octep_device *oct)
981981
oct->mmio[i].hw_addr =
982982
ioremap(pci_resource_start(oct->pdev, i * 2),
983983
pci_resource_len(oct->pdev, i * 2));
984+
if (!oct->mmio[i].hw_addr)
985+
goto unmap_prev;
986+
984987
oct->mmio[i].mapped = 1;
985988
}
986989

@@ -1015,7 +1018,9 @@ int octep_device_setup(struct octep_device *oct)
10151018
return 0;
10161019

10171020
unsupported_dev:
1018-
for (i = 0; i < OCTEP_MMIO_REGIONS; i++)
1021+
i = OCTEP_MMIO_REGIONS;
1022+
unmap_prev:
1023+
while (i--)
10191024
iounmap(oct->mmio[i].hw_addr);
10201025

10211026
kfree(oct->conf);

0 commit comments

Comments
 (0)