* [PATCH] um: Remove some unnecessary NULL checks in vector_user.c
@ 2020-03-27 19:36 Alex Dewar
2020-03-29 21:57 ` Richard Weinberger
0 siblings, 1 reply; 2+ messages in thread
From: Alex Dewar @ 2020-03-27 19:36 UTC (permalink / raw)
Cc: Alex Dewar, Jeff Dike, Richard Weinberger, Anton Ivanov,
linux-um, linux-kernel
kfree() already checks for null pointers, so additional checking is
unnecessary.
Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
---
arch/um/drivers/vector_user.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/arch/um/drivers/vector_user.c b/arch/um/drivers/vector_user.c
index ddcd917be0af..aa28e9eecb7b 100644
--- a/arch/um/drivers/vector_user.c
+++ b/arch/um/drivers/vector_user.c
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
--
2.26.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] um: Remove some unnecessary NULL checks in vector_user.c
2020-03-27 19:36 [PATCH] um: Remove some unnecessary NULL checks in vector_user.c Alex Dewar
@ 2020-03-29 21:57 ` Richard Weinberger
0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2020-03-29 21:57 UTC (permalink / raw)
To: Alex Dewar; +Cc: Richard Weinberger, Jeff Dike, linux-um, LKML, Anton Ivanov
On Fri, Mar 27, 2020 at 8:38 PM Alex Dewar <alex.dewar@gmx.co.uk> wrote:
>
> kfree() already checks for null pointers, so additional checking is
> unnecessary.
>
> Signed-off-by: Alex Dewar <alex.dewar@gmx.co.uk>
Applied, thanks!
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-29 21:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 19:36 [PATCH] um: Remove some unnecessary NULL checks in vector_user.c Alex Dewar
2020-03-29 21:57 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).