diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-12-15 05:07:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-12-15 12:42:27 -0500 |
commit | 40d24c4d8a7430aa4dfd7a665fa3faf3b05b673f (patch) | |
tree | 537f199c9badaf0e3d53601249e66bb6d877b8b8 /drivers/isdn | |
parent | 2b2b31c845d3dec6f9960db92d0993ddfc2d2b7f (diff) |
mISDN: fix a loop count
There are two issue here.
1) cnt starts as maxloop + 1 so all these loops iterate one more time
than intended.
2) At the end of the loop we test for "if (maxloop && !cnt)" but for
the first two loops, we end with cnt equal to -1. Changing this to
a pre-op means we end with cnt set to 0.
Fixes: cae86d4a4e56 ('mISDN: Add driver for Infineon ISDN chipset family')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/hardware/mISDN/mISDNipac.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c index a77eea594b69..cb428b9ee441 100644 --- a/drivers/isdn/hardware/mISDN/mISDNipac.c +++ b/drivers/isdn/hardware/mISDN/mISDNipac.c | |||
@@ -1170,7 +1170,7 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) | |||
1170 | 1170 | ||
1171 | if (ipac->type & IPAC_TYPE_IPACX) { | 1171 | if (ipac->type & IPAC_TYPE_IPACX) { |
1172 | ista = ReadIPAC(ipac, ISACX_ISTA); | 1172 | ista = ReadIPAC(ipac, ISACX_ISTA); |
1173 | while (ista && cnt--) { | 1173 | while (ista && --cnt) { |
1174 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); | 1174 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); |
1175 | if (ista & IPACX__ICA) | 1175 | if (ista & IPACX__ICA) |
1176 | ipac_irq(&ipac->hscx[0], ista); | 1176 | ipac_irq(&ipac->hscx[0], ista); |
@@ -1182,7 +1182,7 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) | |||
1182 | } | 1182 | } |
1183 | } else if (ipac->type & IPAC_TYPE_IPAC) { | 1183 | } else if (ipac->type & IPAC_TYPE_IPAC) { |
1184 | ista = ReadIPAC(ipac, IPAC_ISTA); | 1184 | ista = ReadIPAC(ipac, IPAC_ISTA); |
1185 | while (ista && cnt--) { | 1185 | while (ista && --cnt) { |
1186 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); | 1186 | pr_debug("%s: ISTA %02x\n", ipac->name, ista); |
1187 | if (ista & (IPAC__ICD | IPAC__EXD)) { | 1187 | if (ista & (IPAC__ICD | IPAC__EXD)) { |
1188 | istad = ReadISAC(isac, ISAC_ISTA); | 1188 | istad = ReadISAC(isac, ISAC_ISTA); |
@@ -1200,7 +1200,7 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) | |||
1200 | ista = ReadIPAC(ipac, IPAC_ISTA); | 1200 | ista = ReadIPAC(ipac, IPAC_ISTA); |
1201 | } | 1201 | } |
1202 | } else if (ipac->type & IPAC_TYPE_HSCX) { | 1202 | } else if (ipac->type & IPAC_TYPE_HSCX) { |
1203 | while (cnt) { | 1203 | while (--cnt) { |
1204 | ista = ReadIPAC(ipac, IPAC_ISTAB + ipac->hscx[1].off); | 1204 | ista = ReadIPAC(ipac, IPAC_ISTAB + ipac->hscx[1].off); |
1205 | pr_debug("%s: B2 ISTA %02x\n", ipac->name, ista); | 1205 | pr_debug("%s: B2 ISTA %02x\n", ipac->name, ista); |
1206 | if (ista) | 1206 | if (ista) |
@@ -1211,7 +1211,6 @@ mISDNipac_irq(struct ipac_hw *ipac, int maxloop) | |||
1211 | mISDNisac_irq(isac, istad); | 1211 | mISDNisac_irq(isac, istad); |
1212 | if (0 == (ista | istad)) | 1212 | if (0 == (ista | istad)) |
1213 | break; | 1213 | break; |
1214 | cnt--; | ||
1215 | } | 1214 | } |
1216 | } | 1215 | } |
1217 | if (cnt > maxloop) /* only for ISAC/HSCX without PCI IRQ test */ | 1216 | if (cnt > maxloop) /* only for ISAC/HSCX without PCI IRQ test */ |