Skip to content

Commit 4398679

Browse files
ZhouyangJiagregkh
authored andcommitted
ipack: add error handling for ioremap_nocache
When ioremap_nocache fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling ioremap_nocache. Signed-off-by: Zhouyang Jia <[email protected]> Acked-by: Samuel Iglesias Gonsalvez <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5c74f27 commit 4398679

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/ipack/carriers/tpci200.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,13 @@ static int tpci200_register(struct tpci200_board *tpci200)
304304
ioremap_nocache(pci_resource_start(tpci200->info->pdev,
305305
TPCI200_IP_INTERFACE_BAR),
306306
TPCI200_IFACE_SIZE);
307+
if (!tpci200->info->interface_regs) {
308+
dev_err(&tpci200->info->pdev->dev,
309+
"(bn 0x%X, sn 0x%X) failed to map driver user space!",
310+
tpci200->info->pdev->bus->number,
311+
tpci200->info->pdev->devfn);
312+
goto out_release_mem8_space;
313+
}
307314

308315
/* Initialize lock that protects interface_regs */
309316
spin_lock_init(&tpci200->regs_lock);

0 commit comments

Comments
 (0)