Skip to content

Commit 21698fd

Browse files
qiaomartingregkh
authored andcommitted
parport_pc: fix find_superio io compare code, should use equal test.
In the original code before 181bf1e the loop was continuing until it finds the first matching superios[i].io and p->base. But after 181bf1e the logic changed and the loop now returns the pointer to the first mismatched array element which is then used in get_superio_dma() and get_superio_irq() and thus returning the wrong value. Fix the condition so that it now returns the correct pointer. Fixes: 181bf1e ("parport_pc: clean up the modified while loops using for") Cc: Alan Cox <[email protected]> Cc: [email protected] Signed-off-by: QiaoChong <[email protected]> [rewrite the commit message] Signed-off-by: Sudip Mukherjee <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 492b7a8 commit 21698fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/parport/parport_pc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p)
13771377
{
13781378
int i;
13791379
for (i = 0; i < NR_SUPERIOS; i++)
1380-
if (superios[i].io != p->base)
1380+
if (superios[i].io == p->base)
13811381
return &superios[i];
13821382
return NULL;
13831383
}

0 commit comments

Comments
 (0)