Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1648660
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 5/5] MIPS: VPE: Adjust 13 checks for null pointers |
| Date | 2017-05-23 23:00 +0200 |
| Message-ID | <tKp4o-7w-51@gated-at.bofh.it> (permalink) |
| References | <tKp4m-7w-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 23 May 2017 22:16:24 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The script “checkpatch.pl” pointed information out like the following.
Comparison to NULL could be written …
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/mips/kernel/vpe.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index ed019218496b..0ef7654e67e4 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -97,4 +97,4 @@ struct vpe *alloc_vpe(int minor)
- if (v == NULL)
+ if (!v)
goto out;
INIT_LIST_HEAD(&v->tc);
@@ -118,4 +118,4 @@ struct tc *alloc_tc(int index)
- if (tc == NULL)
+ if (!tc)
goto out;
INIT_LIST_HEAD(&tc->tc);
@@ -340,10 +340,9 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
/* Sign extend the addend we extract from the lo insn. */
vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
- if (mips_hi16_list != NULL) {
-
+ if (mips_hi16_list) {
l = mips_hi16_list;
- while (l != NULL) {
+ while (l) {
unsigned long insn;
/*
@@ -391,7 +390,7 @@ static int apply_r_mips_lo16(struct module *me, uint32_t *location,
return 0;
out_free:
- while (l != NULL) {
+ while (l) {
next = l->next;
kfree(l);
l = next;
@@ -562,7 +561,7 @@ static int find_vpe_symbols(struct vpe *v, Elf_Shdr *sechdrs,
v->shared_ptr = (void *)sym[i].st_value;
}
- if ((v->__start == 0) || (v->shared_ptr == NULL))
+ if ((v->__start == 0) || !v->shared_ptr)
return -1;
return 0;
@@ -737,7 +736,7 @@ static int vpe_elfload(struct vpe *v)
return -ENOEXEC;
}
- if (v->shared_ptr == NULL)
+ if (!v->shared_ptr)
pr_warn("VPE loader: program does not contain vpe_shared symbol.\n"
" Unable to use AMVP (AP/SP) facilities.\n");
}
@@ -777,7 +776,7 @@ static int vpe_open(struct inode *inode, struct file *filp)
}
v = get_vpe(aprp_cpu_index());
- if (v == NULL) {
+ if (!v) {
pr_warn("VPE loader: unable to get vpe\n");
return -ENODEV;
@@ -822,7 +821,7 @@ static int vpe_release(struct inode *inode, struct file *filp)
int ret = 0;
v = get_vpe(aprp_cpu_index());
- if (v == NULL)
+ if (!v)
return -ENODEV;
hdr = (Elf_Ehdr *) v->pbuffer;
@@ -866,8 +865,7 @@ static ssize_t vpe_write(struct file *file, const char __user *buffer,
return -ENODEV;
v = get_vpe(aprp_cpu_index());
-
- if (v == NULL)
+ if (!v)
return -ENODEV;
if ((count + v->len) > v->plen) {
@@ -895,7 +893,7 @@ void *vpe_get_shared(int index)
{
struct vpe *v = get_vpe(index);
- if (v == NULL)
+ if (!v)
return NULL;
return v->shared_ptr;
@@ -906,7 +904,7 @@ int vpe_notify(int index, struct vpe_notifications *notify)
{
struct vpe *v = get_vpe(index);
- if (v == NULL)
+ if (!v)
return -1;
list_add(¬ify->list, &v->notify);
@@ -918,7 +916,7 @@ char *vpe_getcwd(int index)
{
struct vpe *v = get_vpe(index);
- if (v == NULL)
+ if (!v)
return NULL;
return v->cwd;
--
2.13.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] MIPS-kernel: Adjustments for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 23:00 +0200 [PATCH 2/5] MIPS: smp-cps: Delete error messages for failed memory allocations in cps_prepare_cpus() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 23:00 +0200 [PATCH 3/5] MIPS: VPE: Delete an error message for a failed memory allocation in vpe_open() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 23:00 +0200 [PATCH 5/5] MIPS: VPE: Adjust 13 checks for null pointers SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 23:00 +0200 [PATCH 4/5] MIPS: VPE: Improve a size determination in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 23:00 +0200 [PATCH 1/5] MIPS: pm-cps: Delete an error message for a failed memory allocation in cps_pm_online_cpu() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-23 23:00 +0200 Re: [PATCH 0/5] MIPS-kernel: Adjustments for some function implementations Joe Perches <joe@perches.com> - 2017-05-23 23:20 +0200
csiph-web