diff mbox

cx88: Missing failure checks

Message ID 20090326220428.50523141@pedra.chehab.org (mailing list archive)
State Accepted
Headers show

Commit Message

Mauro Carvalho Chehab March 27, 2009, 1:04 a.m. UTC
Forwarded message:

Date: Thu, 26 Mar 2009 20:44:38 +0000
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: linux-kernel@vger.kernel.org, mchehab@infradead.org
Subject: [PATCH] cx88: Missing failure checks


The ioremap one was reported in October 2007 (Bug 9146), the kmalloc one
was blindingly obvious while looking at the ioremap one

The bug suggests some other configuration for lots of I/O memory (32MB per
device is ioremapped) but I'll leave that to the real maintainers

Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
---

 drivers/media/video/cx88/cx88-cards.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)







Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Trent Piepho March 27, 2009, 4:07 a.m. UTC | #1
On Thu, 26 Mar 2009, Mauro Carvalho Chehab wrote:
> From: Alan Cox <alan@lxorguk.ukuu.org.uk>
> To: linux-kernel@vger.kernel.org, mchehab@infradead.org
> Subject: [PATCH] cx88: Missing failure checks
>
> The ioremap one was reported in October 2007 (Bug 9146), the kmalloc one
> was blindingly obvious while looking at the ioremap one
>
> The bug suggests some other configuration for lots of I/O memory (32MB per
> device is ioremapped) but I'll leave that to the real maintainers

Each function has a 16 MB window and Linux can use three of the functions.

IIRC, all the function's register windows are the same so only one needs to
be mapped.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 733ede3..2fa02cf 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -3089,6 +3089,8 @@  struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
 	int i;
 
 	core = kzalloc(sizeof(*core), GFP_KERNEL);
+	if (core == NULL)
+		return NULL;
 
 	atomic_inc(&core->refcount);
 	core->pci_bus  = pci->bus->number;
@@ -3110,6 +3112,11 @@  struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
 	core->lmmio = ioremap(pci_resource_start(pci, 0),
 			      pci_resource_len(pci, 0));
 	core->bmmio = (u8 __iomem *)core->lmmio;
+	
+	if (core->lmmio == NULL) {
+		kfree(core);
+		return NULL;
+	}
 
 	/* board config */
 	core->boardnr = UNSET;