aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport/parport_pc.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-06-11 08:06:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-11 11:51:03 -0400
commit73e0d48b8c28fb39a0bb6713c875e9919a9af546 (patch)
treeb250b867130a9233a0daa6cbf2ba11b9a5e868a1 /drivers/parport/parport_pc.c
parent0b4068a1287b02018d1b3159e7be6f27f3e3e68c (diff)
parport_pc: Fix subscription bugs
This patch fixes array subscription bugs in the parport_pc driver. drivers/parport/parport_pc.c: In function ‘parport_irq_probe’: drivers/parport/parport_pc.c:1589: warning: array subscript is above array bounds drivers/parport/parport_pc.c: In function ‘parport_pc_probe_port’: drivers/parport/parport_pc.c:1579: warning: array subscript is above array bounds The patch also fixes a few other array bugs, which the compiler was unable to find. Coding style violations are also fixed. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/parport/parport_pc.c')
-rw-r--r--drivers/parport/parport_pc.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 4e63cc9e277..24984c4a1ba 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1246,17 +1246,17 @@ static void __devinit show_parconfig_smsc37c669(int io, int key)
1246 (cr1 & 0x08 ) ? "Standard mode only (SPP)" : modes[cr4 & 0x03], 1246 (cr1 & 0x08 ) ? "Standard mode only (SPP)" : modes[cr4 & 0x03],
1247 (cr4 & 0x40) ? "1.7" : "1.9"); 1247 (cr4 & 0x40) ? "1.7" : "1.9");
1248 } 1248 }
1249 1249
1250 /* Heuristics ! BIOS setup for this mainboard device limits 1250 /* Heuristics ! BIOS setup for this mainboard device limits
1251 the choices to standard settings, i.e. io-address and IRQ 1251 the choices to standard settings, i.e. io-address and IRQ
1252 are related, however DMA can be 1 or 3, assume DMA_A=DMA1, 1252 are related, however DMA can be 1 or 3, assume DMA_A=DMA1,
1253 DMA_C=DMA3 (this is true e.g. for TYAN 1564D Tomcat IV) */ 1253 DMA_C=DMA3 (this is true e.g. for TYAN 1564D Tomcat IV) */
1254 if(cr23*4 >=0x100) { /* if active */ 1254 if (cr23 * 4 >= 0x100) { /* if active */
1255 while((superios[i].io!= 0) && (i<NR_SUPERIOS)) 1255 while ((i < NR_SUPERIOS) && (superios[i].io != 0))
1256 i++; 1256 i++;
1257 if(i==NR_SUPERIOS) 1257 if (i == NR_SUPERIOS) {
1258 printk(KERN_INFO "Super-IO: too many chips!\n"); 1258 printk(KERN_INFO "Super-IO: too many chips!\n");
1259 else { 1259 } else {
1260 int d; 1260 int d;
1261 switch (cr23*4) { 1261 switch (cr23*4) {
1262 case 0x3bc: 1262 case 0x3bc:
@@ -1332,12 +1332,12 @@ static void __devinit show_parconfig_winbond(int io, int key)
1332 printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", modes[crf0 & 0x07]); 1332 printk(KERN_INFO "Winbond LPT Config: Port mode=%s\n", modes[crf0 & 0x07]);
1333 } 1333 }
1334 1334
1335 if(cr30 & 0x01) { /* the settings can be interrogated later ... */ 1335 if (cr30 & 0x01) { /* the settings can be interrogated later ... */
1336 while((superios[i].io!= 0) && (i<NR_SUPERIOS)) 1336 while ((i < NR_SUPERIOS) && (superios[i].io != 0))
1337 i++; 1337 i++;
1338 if(i==NR_SUPERIOS) 1338 if (i == NR_SUPERIOS) {
1339 printk(KERN_INFO "Super-IO: too many chips!\n"); 1339 printk(KERN_INFO "Super-IO: too many chips!\n");
1340 else { 1340 } else {
1341 superios[i].io = (cr60<<8)|cr61; 1341 superios[i].io = (cr60<<8)|cr61;
1342 superios[i].irq = cr70&0x0f; 1342 superios[i].irq = cr70&0x0f;
1343 superios[i].dma = (((cr74 & 0x07) > 3) ? 1343 superios[i].dma = (((cr74 & 0x07) > 3) ?
@@ -1575,24 +1575,26 @@ static void __devinit detect_and_report_it87(void)
1575 1575
1576static int get_superio_dma (struct parport *p) 1576static int get_superio_dma (struct parport *p)
1577{ 1577{
1578 int i=0; 1578 int i = 0;
1579 while( (superios[i].io != p->base) && (i<NR_SUPERIOS)) 1579
1580 while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
1580 i++; 1581 i++;
1581 if (i!=NR_SUPERIOS) 1582 if (i != NR_SUPERIOS)
1582 return superios[i].dma; 1583 return superios[i].dma;
1583 return PARPORT_DMA_NONE; 1584 return PARPORT_DMA_NONE;
1584} 1585}
1585 1586
1586static int get_superio_irq (struct parport *p) 1587static int get_superio_irq (struct parport *p)
1587{ 1588{
1588 int i=0; 1589 int i = 0;
1589 while( (superios[i].io != p->base) && (i<NR_SUPERIOS)) 1590
1591 while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
1590 i++; 1592 i++;
1591 if (i!=NR_SUPERIOS) 1593 if (i != NR_SUPERIOS)
1592 return superios[i].irq; 1594 return superios[i].irq;
1593 return PARPORT_IRQ_NONE; 1595 return PARPORT_IRQ_NONE;
1594} 1596}
1595 1597
1596 1598
1597/* --- Mode detection ------------------------------------- */ 1599/* --- Mode detection ------------------------------------- */
1598 1600