The function rte_malloc() could return NULL, the return value
need to be checked.
Fixes:
ce7ea764597e ("net/mvneta: support Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Liron Himi <lironh@marvell.com>
int ret, i;
descs = rte_malloc("rxdesc", MRVL_NETA_RXD_MAX * sizeof(*descs), 0);
+ if (descs == NULL) {
+ MVNETA_LOG(ERR, "Failed to allocate descs.");
+ return;
+ }
+
bufs = rte_malloc("buffs", MRVL_NETA_RXD_MAX * sizeof(*bufs), 0);
+ if (bufs == NULL) {
+ MVNETA_LOG(ERR, "Failed to allocate bufs.");
+ rte_free(descs);
+ return;
+ }
do {
num = MRVL_NETA_RXD_MAX;