Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9bdcd9b authored by Roel Kluin's avatar Roel Kluin Committed by David S. Miller
Browse files

net pcmcia: worklimit reaches -1



with while (--worklimit >= 0); worklimit reaches -1 after the loop. In
3c589_cs.c this caused a warning not to be printed.

In 3c574_cs.c contrastingly, el3_rx() treats worklimit differently:

static int el3_rx(struct net_device *dev, int worklimit)
{
	while (--worklimit >= 0) { ... }
	return worklimit;
}

el3_rx() is only called by function el3_interrupt(): twice:

static irqreturn_t el3_interrupt(int irq, void *dev_id)
{
        int work_budget = max_interrupt_work;
	while(...) {
		if (...)
			work_budget = el3_rx(dev, work_budget);
		if (...)
			work_budget = el3_rx(dev, work_budget);
		if (--work_budget < 0) {
		        ...
		        break;
		}
	}
}
The error path can occur 2 too early.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 858b9ced
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1035,7 +1035,8 @@ static int el3_rx(struct net_device *dev, int worklimit)
	DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
	DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
		  dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
		  dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus));
	while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
	while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) &&
		   (--worklimit >= 0)) {
			worklimit > 0) {
		worklimit--;
		if (rx_status & 0x4000) { /* Error, update stats. */
		if (rx_status & 0x4000) { /* Error, update stats. */
			short error = rx_status & 0x3800;
			short error = rx_status & 0x3800;
			dev->stats.rx_errors++;
			dev->stats.rx_errors++;
+2 −1
Original line number Original line Diff line number Diff line
@@ -857,7 +857,8 @@ static int el3_rx(struct net_device *dev)
    DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
    DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n",
	  dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
	  dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
    while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
    while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) &&
	   (--worklimit >= 0)) {
		    worklimit > 0) {
	worklimit--;
	if (rx_status & 0x4000) { /* Error, update stats. */
	if (rx_status & 0x4000) { /* Error, update stats. */
	    short error = rx_status & 0x3800;
	    short error = rx_status & 0x3800;
	    dev->stats.rx_errors++;
	    dev->stats.rx_errors++;