summaryrefslogtreecommitdiff
path: root/drivers/ipack/carriers/tpci200.c
diff options
context:
space:
mode:
authorZhouyang Jia <jiazhouyang09@gmail.com>2018-06-12 06:07:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-07 18:19:27 +0300
commit43986798fd504c8cd846e3c65bcf732e3f971938 (patch)
tree7b7a2b0eca8719b452d00db3d5f456d6efde90a7 /drivers/ipack/carriers/tpci200.c
parent5c74f27bf6ca9e2b30ba5d7ae11831f89c41b37a (diff)
downloadlinux-43986798fd504c8cd846e3c65bcf732e3f971938.tar.xz
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 <jiazhouyang09@gmail.com> Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/ipack/carriers/tpci200.c')
-rw-r--r--drivers/ipack/carriers/tpci200.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c
index a16b320739b4..8a9c169b6f99 100644
--- a/drivers/ipack/carriers/tpci200.c
+++ b/drivers/ipack/carriers/tpci200.c
@@ -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);