sfc: Added checks for heap allocation failure
authorBen Hutchings <bhutchings@solarflare.com>
Fri, 16 May 2008 20:20:20 +0000 (21:20 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 22 May 2008 09:59:34 +0000 (05:59 -0400)
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/sfc/selftest.c
drivers/net/sfc/tenxpress.c
drivers/net/sfc/xfp_phy.c

index c98f350525a7c9fe3b4ea709c48404a048fae250..3b2de9fe7f27ee6607a3cdc17cf8a443285287c5 100644 (file)
@@ -517,6 +517,8 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
                state->packet_count = min(1 << (i << 2), state->packet_count);
                state->skbs = kzalloc(sizeof(state->skbs[0]) *
                                      state->packet_count, GFP_KERNEL);
+               if (!state->skbs)
+                       return -ENOMEM;
                state->flush = 0;
 
                EFX_LOG(efx, "TX queue %d testing %s loopback with %d "
index 38e96ed33d333a1c6c53a7fa3296e7573c231956..c0146061c3265ee461ca421920c272884dc6720d 100644 (file)
@@ -211,6 +211,8 @@ static int tenxpress_phy_init(struct efx_nic *efx)
        int rc = 0;
 
        phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
+       if (!phy_data)
+               return -ENOMEM;
        efx->phy_data = phy_data;
 
        tenxpress_set_state(efx, TENXPRESS_STATUS_NORMAL);
index cf75fab3e77eb93b33a00e2596455c50bb685bd2..f3684ad28887b66648d1592e248f1beac81e7d06 100644 (file)
@@ -85,6 +85,8 @@ static int xfp_phy_init(struct efx_nic *efx)
        int rc;
 
        phy_data = kzalloc(sizeof(struct xfp_phy_data), GFP_KERNEL);
+       if (!phy_data)
+               return -ENOMEM;
        efx->phy_data = phy_data;
 
        EFX_INFO(efx, "XFP: PHY ID reg %x (OUI %x model %x revision"