The fd is possibly a negative value while it is passed as an
argument to function "close". Fix the check to the fd.
Fixes:
b9c94167904f ("bus/dpaa: decouple FQ portal alloc and init")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
struct qm_portal_config *q_pcfg;
struct dpaa_ioctl_irq_map irq_map;
struct dpaa_ioctl_portal_map q_map = {0};
- int q_fd = 0, ret;
+ int q_fd, ret;
q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0);
if (!q_pcfg) {
if (!portal) {
pr_err("Qman portal initialisation failed (%d)\n",
q_pcfg->cpu);
- goto err;
+ goto err_alloc;
}
irq_map.type = dpaa_portal_qman;
*fd = q_fd;
return portal;
+err_alloc:
+ close(q_fd);
err:
- if (q_fd)
- close(q_fd);
process_portal_unmap(&q_map.addr);
kfree(q_pcfg);
return NULL;