[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190122150344.8072-1-qiaochong@loongson.cn>
Date: Tue, 22 Jan 2019 23:03:44 +0800
From: qiaochong <qiaochong@...ngson.cn>
To: Sudip Mukherjee <sudipm.mukherjee@...il.com>
Cc: linux-kernel@...r.kernel.org, QiaoChong <qiaochong@...ngson.cn>
Subject: [PATCH] parport_pc: fix find_superio io compare code, should use equal test.
From: QiaoChong <qiaochong@...ngson.cn>
git blame drivers/parport/parport_pc.c
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1376) static struct superio_struct *find_superio(struct parport *p)
^1da177e4c3f4 (Linus Torvalds 2005-04-16 15:20:36 -0700 1377) {
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1378) int i;
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1379) for (i = 0; i < NR_SUPERIOS; i++)
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1380) if (superios[i].io != p->base)
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1381) return &superios[i];
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1382) return NULL;
181bf1e815a2a (Alan Cox 2009-06-11 13:08:10 +0100 1383) }
73e0d48b8c28f (Michael Buesch 2009-06-11 13:06:31 +0100 1384)
git log -1 -p 181bf1e815a2a
-static int get_superio_dma(struct parport *p)
+static struct superio_struct *find_superio(struct parport *p)
{
- int i = 0;
+ int i;
+ for (i = 0; i < NR_SUPERIOS; i++)
+ if (superios[i].io != p->base)
+ return &superios[i];
+ return NULL;
+}
- while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
- i++;
- if (i != NR_SUPERIOS)
- return superios[i].dma;
the code before 181bf1e815a2a also mean superio[i].io == p->base, fixup it.
Signed-off-by: QiaoChong <qiaochong@...ngson.cn>
---
drivers/parport/parport_pc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 9c8249f744792..6296dbb83d470 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;
}
--
2.17.1
Powered by blists - more mailing lists