sfc: check for allocation failure
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Sep 2013 15:07:27 +0000 (18:07 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Sep 2013 17:07:47 +0000 (13:07 -0400)
It upsets static analyzers when we don't check for allocation failure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/sfc/falcon.c

index 8685f99d872a20a24bf7f8101e9182d5d3524439..ff5d322b9b49698842bdfc7a19117c8054829c86 100644 (file)
@@ -893,6 +893,8 @@ static int falcon_mtd_probe(struct efx_nic *efx)
 
        /* Allocate space for maximum number of partitions */
        parts = kcalloc(2, sizeof(*parts), GFP_KERNEL);
+       if (!parts)
+               return -ENOMEM;
        n_parts = 0;
 
        spi = &nic_data->spi_flash;