Skip to contentSkip to conversation

/drivers/char/rio ioremap balancing/ returncode check

PATCH In review Scott Thompson 3 participants 3 messages Aug 13, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /drivers/char/rio ioremap balancing/ returncode check

patchset against 2.6.23-rc2 and this set is an audit of /drivers/char/a*
through drivers/char .

this corrects missing ioremap return checks and balancing on iounmap calls..

Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
----------------------------------------------------------

(quoted diff) +0 -0

b/drivers/char/rio/rio_linux.c
index 0ce9667..fdaf44f 100644

drivers/char/rio/rio_linux.c +2 -0
@@ -924,6 +924,11 @@ static void fix_rio_pci(struct pci_dev *pdev)
 
 	hwbase = pci_resource_start(pdev, 0);
 	rebase = ioremap(hwbase, 0x80);
+	if (!rebase) {
+		printk(KERN_DEBUG "rio: unable to perform cntrl reg fix as 

ioremap call failed\n");
+ return;
+ }
+
t = readl(rebase + CNTRL_REG_OFFSET);
if (t != CNTRL_REG_GOODVALUE) {
printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x ->
%08x\n", t, CNTRL_REG_GOODVALUE);
@@ -996,6 +1001,11 @@ static int __init rio_init(void)
if (((1 << hp->Ivec) & rio_irqmask) = 0)
hp->Ivec = 0;
hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP,
RIO_WINDOW_LEN);
+ if (!hp->Caddr) {
+ printk(KERN_ERR "RIO: Unable to ioremap.\n");
+ return -ENOMEM;
+ }
+
hp->CardP = (struct DpRam __iomem *) hp->Caddr; hp->Type = RIO_PCI;
hp->Copy = rio_copy_to_card;
@@ -1049,6 +1059,10 @@ static int __init rio_init(void)
hp->Ivec = 0;
hp->Ivec |= 0x8000; /* Mark as non-sharable */
hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP,
RIO_WINDOW_LEN);
+ if (!hp->Caddr) {
+ printk(KERN_ERR "RIO: Unable to ioremap.\n");
+ return -ENOMEM;
+ }
hp->CardP = (struct DpRam __iomem *) hp->Caddr; hp->Type = RIO_PCI;
hp->Copy = rio_copy_to_card;

#1 lore raw
Quoted 6 lines · On Mon, 13 Aug 2007 00:05:30 -0400 "Scott Thompson" <[email protected]>…

patchset against 2.6.23-rc2 and this set is an audit of /drivers/char/a*
through drivers/char .

this corrects missing ioremap return checks and balancing on iounmap calls..

Your mail client has wrapped the patches. Please resend without wrapping

#2 lore raw
In reply to Scott Thompson

why [email protected]?

Scott Thompson napsal(a):

Quoted 29 lines

patchset against 2.6.23-rc2 and this set is an audit of /drivers/char/a*
through drivers/char .

this corrects missing ioremap return checks and balancing on iounmap calls..

Signed-off-by: Scott Thompson <postfail <at> hushmail.com>
----------------------------------------------------------

drivers/char/rio/rio_linux.c +5 -0
index 0ce9667..fdaf44f 100644
@@ -924,6 +924,11 @@ static void fix_rio_pci(struct pci_dev *pdev)
 
 	hwbase = pci_resource_start(pdev, 0);
 	rebase = ioremap(hwbase, 0x80);
+	if (!rebase) {
+		printk(KERN_DEBUG "rio: unable to perform cntrl reg fix as 
 ioremap call failed\n");
+		return;
+	}
+		
 	t = readl(rebase + CNTRL_REG_OFFSET);
 	if (t != CNTRL_REG_GOODVALUE) {

printk(KERN_DEBUG "rio: performing cntrl reg fix: %08x ->
%08x\n", t, CNTRL_REG_GOODVALUE);

drivers/char/rio/rio_linux.c static int __init rio_init(void) · line 1008

Quoted 8 lines
drivers/char/rio/rio_linux.c +4 -0
@@ -996,6 +1001,11 @@ static int __init rio_init(void)
 		if (((1 << hp->Ivec) & rio_irqmask) = 0)
 			hp->Ivec = 0;
 		hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, 
 RIO_WINDOW_LEN);
+		if (!hp->Caddr) {
+			printk(KERN_ERR "RIO: Unable to ioremap.\n");
+			return -ENOMEM;
+		}

hmm, and what about the yet inited cards here?

drivers/char/rio/rio_linux.c static int __init rio_init(void) · line 1066

Quoted 13 lines
drivers/char/rio/rio_linux.c +1 -0
+
 		hp->CardP = (struct DpRam __iomem *) hp->Caddr;
 		hp->Type = RIO_PCI;
drivers/char/rio/rio_linux.c +4 -0
 		hp->Copy = rio_copy_to_card;
@@ -1049,6 +1059,10 @@ static int __init rio_init(void)
 			hp->Ivec = 0;
 		hp->Ivec |= 0x8000;	/* Mark as non-sharable */
 		hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, 
 RIO_WINDOW_LEN);
+		if (!hp->Caddr) {
+			printk(KERN_ERR "RIO: Unable to ioremap.\n");
+			return -ENOMEM;
+		}

And here.

Quoted 3 lines
drivers/char/rio/rio_linux.c +0 -0
 		hp->CardP = (struct DpRam __iomem *) hp->Caddr;
 		hp->Type = RIO_PCI;

hp->Copy = rio_copy_to_card;

And what about the one on the line 1093?

Signature · 2 lines
Jiri Slaby ([email protected])
Faculty of Informatics, Masaryk University