* [PATCH] ipack: add error handling for ioremap_nocache
@ 2018-06-12 3:07 Zhouyang Jia
[not found] ` <e33e47ca-a948-1678-fe68-8cd8e7f01287@igalia.com>
0 siblings, 1 reply; 2+ messages in thread
From: Zhouyang Jia @ 2018-06-12 3:07 UTC (permalink / raw)
Cc: Zhouyang Jia, Samuel Iglesias Gonsalvez, Jens Taprogge,
Greg Kroah-Hartman, industrypack-devel, linux-kernel
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>
---
drivers/ipack/carriers/tpci200.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/ipack/carriers/tpci200.c b/drivers/ipack/carriers/tpci200.c
index 9b23843..1612f51 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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipack: add error handling for ioremap_nocache
[not found] ` <e33e47ca-a948-1678-fe68-8cd8e7f01287@igalia.com>
@ 2018-06-12 6:33 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2018-06-12 6:33 UTC (permalink / raw)
To: Samuel Iglesias Gonsálvez
Cc: Zhouyang Jia, Jens Taprogge, industrypack-devel, linux-kernel
On Tue, Jun 12, 2018 at 07:00:55AM +0200, Samuel Iglesias Gonsálvez wrote:
> Hello Markus,
>
> Thanks for the patch!
>
> Patch is,
>
> Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
>
> Greg, Would you mind picking this patch series through your char-misc
> tree?
Will do after 4.18-rc1 is out, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-06-12 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12 3:07 [PATCH] ipack: add error handling for ioremap_nocache Zhouyang Jia
[not found] ` <e33e47ca-a948-1678-fe68-8cd8e7f01287@igalia.com>
2018-06-12 6:33 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox