dpaa_eth: check allocation result
authorMadalin Bucur <madalin.bucur@nxp.com>
Sun, 27 Aug 2017 13:13:43 +0000 (16:13 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Aug 2017 23:41:01 +0000 (16:41 -0700)
Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c

index 73ca8d761e184d0040f1981b574d7f928774d260..42258060f1422ede9f4f92fdd4027d74f7f21c9d 100644 (file)
@@ -2561,6 +2561,9 @@ static struct dpaa_bp *dpaa_bp_alloc(struct device *dev)
 
        dpaa_bp->bpid = FSL_DPAA_BPID_INV;
        dpaa_bp->percpu_count = devm_alloc_percpu(dev, *dpaa_bp->percpu_count);
+       if (!dpaa_bp->percpu_count)
+               return ERR_PTR(-ENOMEM);
+
        dpaa_bp->config_count = FSL_DPAA_ETH_MAX_BUF_COUNT;
 
        dpaa_bp->seed_cb = dpaa_bp_seed;