Commit 4a7c4624 authored by Alex Dewar's avatar Alex Dewar Committed by Richard Weinberger

um: Remove some unnecessary NULL checks in vector_user.c

kfree() already checks for null pointers, so additional checking is
unnecessary.
Signed-off-by: default avatarAlex Dewar <alex.dewar@gmx.co.uk>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 237ce2e6
...@@ -221,8 +221,7 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec) ...@@ -221,8 +221,7 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec)
return result; return result;
tap_cleanup: tap_cleanup:
printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd); printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd);
if (result != NULL) kfree(result);
kfree(result);
return NULL; return NULL;
} }
...@@ -266,8 +265,7 @@ static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec) ...@@ -266,8 +265,7 @@ static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec)
return result; return result;
hybrid_cleanup: hybrid_cleanup:
printk(UM_KERN_ERR "user_init_hybrid: init failed"); printk(UM_KERN_ERR "user_init_hybrid: init failed");
if (result != NULL) kfree(result);
kfree(result);
return NULL; return NULL;
} }
...@@ -344,10 +342,8 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id) ...@@ -344,10 +342,8 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id)
unix_cleanup: unix_cleanup:
if (fd >= 0) if (fd >= 0)
os_close_file(fd); os_close_file(fd);
if (remote_addr != NULL) kfree(remote_addr);
kfree(remote_addr); kfree(result);
if (result != NULL)
kfree(result);
return NULL; return NULL;
} }
...@@ -382,8 +378,7 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec) ...@@ -382,8 +378,7 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec)
return result; return result;
raw_cleanup: raw_cleanup:
printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err); printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err);
if (result != NULL) kfree(result);
kfree(result);
return NULL; return NULL;
} }
......
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