Skip to content

Commit

Permalink
[PATCH] Remove unnecessary check in drivers/net/depca.c
Browse files Browse the repository at this point in the history
This was spotted by coverity (cid #793).  All callers dereference dev
before calling this functions, and we dereference it earlier in the
function, when initializing lp.

Signed-off-by: Eric Sesterhenn <[email protected]>
Cc: Jeff Garzik <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
  • Loading branch information
SesterhennEric authored and Jeff Garzik committed Dec 2, 2006
1 parent a189317 commit 107ce6d
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions drivers/net/depca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,24 +1252,22 @@ static void set_multicast_list(struct net_device *dev)
struct depca_private *lp = (struct depca_private *) dev->priv;
u_long ioaddr = dev->base_addr;

if (dev) {
netif_stop_queue(dev);
while (lp->tx_old != lp->tx_new); /* Wait for the ring to empty */

STOP_DEPCA; /* Temporarily stop the depca. */
depca_init_ring(dev); /* Initialize the descriptor rings */
netif_stop_queue(dev);
while (lp->tx_old != lp->tx_new); /* Wait for the ring to empty */

if (dev->flags & IFF_PROMISC) { /* Set promiscuous mode */
lp->init_block.mode |= PROM;
} else {
SetMulticastFilter(dev);
lp->init_block.mode &= ~PROM; /* Unset promiscuous mode */
}
STOP_DEPCA; /* Temporarily stop the depca. */
depca_init_ring(dev); /* Initialize the descriptor rings */

LoadCSRs(dev); /* Reload CSR3 */
InitRestartDepca(dev); /* Resume normal operation. */
netif_start_queue(dev); /* Unlock the TX ring */
if (dev->flags & IFF_PROMISC) { /* Set promiscuous mode */
lp->init_block.mode |= PROM;
} else {
SetMulticastFilter(dev);
lp->init_block.mode &= ~PROM; /* Unset promiscuous mode */
}

LoadCSRs(dev); /* Reload CSR3 */
InitRestartDepca(dev); /* Resume normal operation. */
netif_start_queue(dev); /* Unlock the TX ring */
}

/*
Expand Down

0 comments on commit 107ce6d

Please sign in to comment.