summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiaoChong <qiaochong@loongson.cn>2019-02-09 20:59:07 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-07-09 22:03:58 +0100
commitd649a8e6dd1a7db5e8dee6505438001a666a6f37 (patch)
tree98f58959f8cf57fe05e4c8d08025b37804d51fed
parent5d4e23ebaed66e2e61d6772a79e462eb3489ebe7 (diff)
downloadlinux-stable-d649a8e6dd1a7db5e8dee6505438001a666a6f37.tar.gz
linux-stable-d649a8e6dd1a7db5e8dee6505438001a666a6f37.tar.bz2
linux-stable-d649a8e6dd1a7db5e8dee6505438001a666a6f37.zip
parport_pc: fix find_superio io compare code, should use equal test.
commit 21698fd57984cd28207d841dbdaa026d6061bceb upstream. In the original code before 181bf1e815a2 the loop was continuing until it finds the first matching superios[i].io and p->base. But after 181bf1e815a2 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: 181bf1e815a2 ("parport_pc: clean up the modified while loops using for") Cc: Alan Cox <alan@linux.intel.com> Signed-off-by: QiaoChong <qiaochong@loongson.cn> [rewrite the commit message] Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/parport/parport_pc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 6b9737d392e2..5b6e0e951a85 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p)
{
int i;
for (i = 0; i < NR_SUPERIOS; i++)
- if (superios[i].io != p->base)
+ if (superios[i].io == p->base)
return &superios[i];
return NULL;
}