chelsio: error path fix
authorStephen Hemminger <shemminger@osdl.org>
Mon, 8 Jan 2007 19:24:26 +0000 (11:24 -0800)
committerJeff Garzik <jeff@garzik.org>
Tue, 9 Jan 2007 07:24:37 +0000 (02:24 -0500)
Fix handling of allocation failure.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/chelsio/my3126.c

index c7731b6f9de319c24487c4ea4a500d243925734c..82fed1dd5005525b1fdbc44d78db6de46e33d6f6 100644 (file)
@@ -170,9 +170,10 @@ static struct cphy *my3126_phy_create(adapter_t *adapter,
 {
        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;