Skip to content

Commit

Permalink
octeon_ep: Add missing check for ioremap
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JiangJias authored and kuba-moo committed Jun 15, 2023
1 parent 76a4c8b commit 9a36e2d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/ethernet/marvell/octeon_ep/octep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,9 @@ int octep_device_setup(struct octep_device *oct)
oct->mmio[i].hw_addr =
ioremap(pci_resource_start(oct->pdev, i * 2),
pci_resource_len(oct->pdev, i * 2));
if (!oct->mmio[i].hw_addr)
goto unmap_prev;

oct->mmio[i].mapped = 1;
}

Expand Down Expand Up @@ -1015,7 +1018,9 @@ int octep_device_setup(struct octep_device *oct)
return 0;

unsupported_dev:
for (i = 0; i < OCTEP_MMIO_REGIONS; i++)
i = OCTEP_MMIO_REGIONS;
unmap_prev:
while (i--)
iounmap(oct->mmio[i].hw_addr);

kfree(oct->conf);
Expand Down

0 comments on commit 9a36e2d

Please sign in to comment.