1 From 21698fd57984cd28207d841dbdaa026d6061bceb Mon Sep 17 00:00:00 2001
2 From: QiaoChong <qiaochong@loongson.cn>
3 Date: Sat, 9 Feb 2019 20:59:07 +0000
4 Subject: parport_pc: fix find_superio io compare code, should use equal test.
6 From: QiaoChong <qiaochong@loongson.cn>
8 commit 21698fd57984cd28207d841dbdaa026d6061bceb upstream.
10 In the original code before 181bf1e815a2 the loop was continuing until
11 it finds the first matching superios[i].io and p->base.
12 But after 181bf1e815a2 the logic changed and the loop now returns the
13 pointer to the first mismatched array element which is then used in
14 get_superio_dma() and get_superio_irq() and thus returning the wrong
16 Fix the condition so that it now returns the correct pointer.
18 Fixes: 181bf1e815a2 ("parport_pc: clean up the modified while loops using for")
19 Cc: Alan Cox <alan@linux.intel.com>
20 Cc: stable@vger.kernel.org
21 Signed-off-by: QiaoChong <qiaochong@loongson.cn>
22 [rewrite the commit message]
23 Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 drivers/parport/parport_pc.c | 2 +-
28 1 file changed, 1 insertion(+), 1 deletion(-)
30 --- a/drivers/parport/parport_pc.c
31 +++ b/drivers/parport/parport_pc.c
32 @@ -1377,7 +1377,7 @@ static struct superio_struct *find_super
35 for (i = 0; i < NR_SUPERIOS; i++)
36 - if (superios[i].io != p->base)
37 + if (superios[i].io == p->base)