[PATCH v4 7/7] dpaa_eth: check allocation result

From: Madalin Bucur
Date: Sun Aug 27 2017 - 09:14:10 EST


Signed-off-by: Madalin Bucur <madalin.bucur@xxxxxxx>
---
drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 73ca8d7..4225806 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -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;
--
2.1.0