Fix handling of allocation failure.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>

--- linux-2.6.20-rc1.orig/drivers/net/chelsio/my3126.c
+++ linux-2.6.20-rc1/drivers/net/chelsio/my3126.c
@@ -170,13 +170,14 @@ static struct cphy *my3126_phy_create(ad
 {
        struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL);
 
-       if (cphy)
-               cphy_init(cphy, adapter, phy_addr, &my3126_ops, mdio_ops);
+       if (!cphy)
+               return NULL;
 
+       cphy_init(cphy, adapter, phy_addr, &my3126_ops, mdio_ops);
        INIT_DELAYED_WORK(&cphy->phy_update, my3216_poll);
        cphy->bmsr = 0;
 
-       return (cphy);
+       return cphy;
 }
 
 /* Chip Reset */

-- 

-
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