aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/3c505.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/3c505.c')
-rw-r--r--drivers/net/3c505.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c
index 6124605bef05..a8107f992fb4 100644
--- a/drivers/net/3c505.c
+++ b/drivers/net/3c505.c
@@ -493,21 +493,27 @@ static bool receive_pcb(struct net_device *dev, pcb_struct * pcb)
493 } 493 }
494 /* read the data */ 494 /* read the data */
495 spin_lock_irqsave(&adapter->lock, flags); 495 spin_lock_irqsave(&adapter->lock, flags);
496 i = 0; 496 for (i = 0; i < MAX_PCB_DATA; i++) {
497 do { 497 for (j = 0; j < 20000; j++) {
498 j = 0; 498 stat = get_status(dev->base_addr);
499 while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && j++ < 20000); 499 if (stat & ACRF)
500 pcb->data.raw[i++] = inb_command(dev->base_addr); 500 break;
501 if (i > MAX_PCB_DATA) 501 }
502 INVALID_PCB_MSG(i); 502 pcb->data.raw[i] = inb_command(dev->base_addr);
503 } while ((stat & ASF_PCB_MASK) != ASF_PCB_END && j < 20000); 503 if ((stat & ASF_PCB_MASK) == ASF_PCB_END || j >= 20000)
504 break;
505 }
504 spin_unlock_irqrestore(&adapter->lock, flags); 506 spin_unlock_irqrestore(&adapter->lock, flags);
507 if (i >= MAX_PCB_DATA) {
508 INVALID_PCB_MSG(i);
509 return false;
510 }
505 if (j >= 20000) { 511 if (j >= 20000) {
506 TIMEOUT_MSG(__LINE__); 512 TIMEOUT_MSG(__LINE__);
507 return false; 513 return false;
508 } 514 }
509 /* woops, the last "data" byte was really the length! */ 515 /* the last "data" byte was really the length! */
510 total_length = pcb->data.raw[--i]; 516 total_length = pcb->data.raw[i];
511 517
512 /* safety check total length vs data length */ 518 /* safety check total length vs data length */
513 if (total_length != (pcb->length + 2)) { 519 if (total_length != (pcb->length + 2)) {