Commit d312a25d authored by YueHaibing's avatar YueHaibing Committed by Richard Weinberger

um: NULL check before kfree is not needed

kfree(NULL) is safe,so this removes NULL check before freeing the mem
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 369cca26
...@@ -1118,15 +1118,10 @@ static int vector_net_close(struct net_device *dev) ...@@ -1118,15 +1118,10 @@ static int vector_net_close(struct net_device *dev)
os_close_file(vp->fds->tx_fd); os_close_file(vp->fds->tx_fd);
vp->fds->tx_fd = -1; vp->fds->tx_fd = -1;
} }
if (vp->bpf != NULL)
kfree(vp->bpf); kfree(vp->bpf);
if (vp->fds->remote_addr != NULL)
kfree(vp->fds->remote_addr); kfree(vp->fds->remote_addr);
if (vp->transport_data != NULL)
kfree(vp->transport_data); kfree(vp->transport_data);
if (vp->header_rxbuffer != NULL)
kfree(vp->header_rxbuffer); kfree(vp->header_rxbuffer);
if (vp->header_txbuffer != NULL)
kfree(vp->header_txbuffer); kfree(vp->header_txbuffer);
if (vp->rx_queue != NULL) if (vp->rx_queue != NULL)
destroy_queue(vp->rx_queue); destroy_queue(vp->rx_queue);
......
...@@ -267,7 +267,6 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec) ...@@ -267,7 +267,6 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec)
os_close_file(rxfd); os_close_file(rxfd);
if (txfd >= 0) if (txfd >= 0)
os_close_file(txfd); os_close_file(txfd);
if (result != NULL)
kfree(result); kfree(result);
return NULL; return NULL;
} }
...@@ -434,7 +433,6 @@ static struct vector_fds *user_init_socket_fds(struct arglist *ifspec, int id) ...@@ -434,7 +433,6 @@ static struct vector_fds *user_init_socket_fds(struct arglist *ifspec, int id)
if (fd >= 0) if (fd >= 0)
os_close_file(fd); os_close_file(fd);
if (result != NULL) { if (result != NULL) {
if (result->remote_addr != NULL)
kfree(result->remote_addr); kfree(result->remote_addr);
kfree(result); kfree(result);
} }
......
...@@ -244,7 +244,6 @@ static void garbage_collect_irq_entries(void) ...@@ -244,7 +244,6 @@ static void garbage_collect_irq_entries(void)
to_free = NULL; to_free = NULL;
} }
walk = walk->next; walk = walk->next;
if (to_free != NULL)
kfree(to_free); kfree(to_free);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment