Commit 9a36e2d4 authored by 蒋家盛's avatar 蒋家盛 Committed by Jakub Kicinski
Browse files

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: 862cd659 ("octeon_ep: Add driver framework and device initialization")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://lore.kernel.org/r/20230615033400.2971-1-jiasheng@iscas.ac.cn


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 76a4c8b8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;
	}

@@ -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);