Skip to contentSkip to conversation

ipack: add error handling for ioremap_nocache

PATCH In review Zhouyang Jia 2 participants 2 messages Jun 12, 2018 1 message not in the archive Industry pack subsystem (ipack)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/ipack/carriers/tpci200.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/ipack/carriers/tpci200.c +7 -0
index 9b23843..1612f51 100644
@@ -304,6 +304,13 @@ static int tpci200_register(struct tpci200_board *tpci200)
 		ioremap_nocache(pci_resource_start(tpci200->info->pdev,
 					   TPCI200_IP_INTERFACE_BAR),
 			TPCI200_IFACE_SIZE);
+	if (!tpci200->info->interface_regs) {
+		dev_err(&tpci200->info->pdev->dev,
+			"(bn 0x%X, sn 0x%X) failed to map driver user space!",
+			tpci200->info->pdev->bus->number,
+			tpci200->info->pdev->devfn);
+		goto out_release_mem8_space;
+	}
 
 	/* Initialize lock that protects interface_regs */
 	spin_lock_init(&tpci200->regs_lock);
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): [email protected]