octeon_ep: Add missing check for ioremap

[ Upstream commit 9a36e2d44d122fe73a2a76ba73f1d50a65cf8210 ]

Add check for ioremap() and return the error if it fails in order to
guarantee the success of ioremap().

Fixes: 862cd659a6 ("octeon_ep: Add driver framework and device initialization")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://lore.kernel.org/r/20230615033400.2971-1-jiasheng@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jiasheng Jiang 2023-06-15 11:34:00 +08:00 committed by Greg Kroah-Hartman
parent 35d848164f
commit 34dc1eed99

View File

@ -928,6 +928,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;
}
@ -966,7 +969,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);