From: Eric Sesterhenn <[EMAIL PROTECTED]>

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]>
---

 drivers/net/depca.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diff -puN drivers/net/depca.c~remove-unnecessary-check-in-drivers-net-depcac 
drivers/net/depca.c
--- a/drivers/net/depca.c~remove-unnecessary-check-in-drivers-net-depcac
+++ a/drivers/net/depca.c
@@ -1252,24 +1252,22 @@ static void set_multicast_list(struct ne
        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 */
+       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 */
-
-               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 */
 }
 
 /*
_
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to