netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/4] pxa168_eth: remove unneeded null check
@ 2010-08-24 16:52 Dan Carpenter
  2010-08-24 21:50 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-08-24 16:52 UTC (permalink / raw)
  To: Sachin Sanap; +Cc: David S. Miller, netdev, kernel-janitors

"pep->pd" isn't checked consistently in this function.  For example it's
dereferenced unconditionally on the next line after the end of the if
condition.  This function is only called from pxa168_eth_probe() and
pep->pd is always non-NULL so I removed the check.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c
index ecc64d7..857a681 100644
--- a/drivers/net/pxa168_eth.c
+++ b/drivers/net/pxa168_eth.c
@@ -1414,10 +1414,8 @@ static int ethernet_phy_setup(struct net_device *dev)
 {
 	struct pxa168_eth_private *pep = netdev_priv(dev);
 
-	if (pep->pd != NULL) {
-		if (pep->pd->init)
-			pep->pd->init();
-	}
+	if (pep->pd->init)
+		pep->pd->init();
 	pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f);
 	if (pep->phy != NULL)
 		phy_init(pep, pep->pd->speed, pep->pd->duplex);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch 1/4] pxa168_eth: remove unneeded null check
  2010-08-24 16:52 [patch 1/4] pxa168_eth: remove unneeded null check Dan Carpenter
@ 2010-08-24 21:50 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-08-24 21:50 UTC (permalink / raw)
  To: error27; +Cc: ssanap, netdev, kernel-janitors

From: Dan Carpenter <error27@gmail.com>
Date: Tue, 24 Aug 2010 18:52:46 +0200

> "pep->pd" isn't checked consistently in this function.  For example it's
> dereferenced unconditionally on the next line after the end of the if
> condition.  This function is only called from pxa168_eth_probe() and
> pep->pd is always non-NULL so I removed the check.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-24 21:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-24 16:52 [patch 1/4] pxa168_eth: remove unneeded null check Dan Carpenter
2010-08-24 21:50 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).