Fix handling of allocation failure.

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

--- netdev-2.6.orig/drivers/net/chelsio/my3126.c
+++ netdev-2.6/drivers/net/chelsio/my3126.c
@@ -170,9 +170,10 @@ 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;
 
-
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