Skip to content

Commit

Permalink
um: Remove some unnecessary NULL checks in vector_user.c
Browse files Browse the repository at this point in the history
kfree() already checks for null pointers, so additional checking is
unnecessary.

Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Alex Dewar authored and Richard Weinberger committed Mar 29, 2020
1 parent 237ce2e commit 4a7c462
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions arch/um/drivers/vector_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ static struct vector_fds *user_init_tap_fds(struct arglist *ifspec)
return result;
tap_cleanup:
printk(UM_KERN_ERR "user_init_tap: init failed, error %d", fd);
if (result != NULL)
kfree(result);
kfree(result);
return NULL;
}

Expand Down Expand Up @@ -266,8 +265,7 @@ static struct vector_fds *user_init_hybrid_fds(struct arglist *ifspec)
return result;
hybrid_cleanup:
printk(UM_KERN_ERR "user_init_hybrid: init failed");
if (result != NULL)
kfree(result);
kfree(result);
return NULL;
}

Expand Down Expand Up @@ -344,10 +342,8 @@ static struct vector_fds *user_init_unix_fds(struct arglist *ifspec, int id)
unix_cleanup:
if (fd >= 0)
os_close_file(fd);
if (remote_addr != NULL)
kfree(remote_addr);
if (result != NULL)
kfree(result);
kfree(remote_addr);
kfree(result);
return NULL;
}

Expand Down Expand Up @@ -382,8 +378,7 @@ static struct vector_fds *user_init_raw_fds(struct arglist *ifspec)
return result;
raw_cleanup:
printk(UM_KERN_ERR "user_init_raw: init failed, error %d", err);
if (result != NULL)
kfree(result);
kfree(result);
return NULL;
}

Expand Down

0 comments on commit 4a7c462

Please sign in to comment.