From: Peng Sun <sironhide0null@gmail.com>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Peng Sun <sironhide0null@gmail.com>
Subject: [PATCH 6/8] fix staging:android style issue:Comparison to NULL could be written
Date: Wed, 26 Aug 2015 11:52:15 +0800 [thread overview]
Message-ID: <1440561137-15574-7-git-send-email-sironhide0null@gmail.com> (raw)
In-Reply-To: <1440561137-15574-6-git-send-email-sironhide0null@gmail.com>
Signed-off-by: Peng Sun <sironhide0null@gmail.com>
---
drivers/staging/android/sw_sync.c | 6 +++---
drivers/staging/android/sync.c | 18 +++++++++---------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/android/sw_sync.c b/drivers/staging/android/sw_sync.c
index c90838d..29b5c35 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file *file)
get_task_comm(task_comm, current);
obj = sw_sync_timeline_create(task_comm);
- if (obj == NULL)
+ if (!obj)
return -ENOMEM;
file->private_data = obj;
@@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct sw_sync_timeline *obj,
}
pt = sw_sync_pt_create(obj, data.value);
- if (pt == NULL) {
+ if (!pt) {
err = -ENOMEM;
goto err;
}
data.name[sizeof(data.name) - 1] = '\0';
fence = sync_fence_create(data.name, pt);
- if (fence == NULL) {
+ if (!fence) {
sync_pt_free(pt);
err = -ENOMEM;
goto err;
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 9a67d23..e0c1acb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
return NULL;
obj = kzalloc(size, GFP_KERNEL);
- if (obj == NULL)
+ if (!obj)
return NULL;
kref_init(&obj->kref);
@@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size)
return NULL;
pt = kzalloc(size, GFP_KERNEL);
- if (pt == NULL)
+ if (!pt)
return NULL;
spin_lock_irqsave(&obj->child_list_lock, flags);
@@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const char *name)
struct sync_fence *fence;
fence = kzalloc(size, GFP_KERNEL);
- if (fence == NULL)
+ if (!fence)
return NULL;
fence->file = anon_inode_getfile("sync_fence", &sync_fence_fops,
@@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)
struct sync_fence *fence;
fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name);
- if (fence == NULL)
+ if (!fence)
return NULL;
fence->num_fences = 1;
@@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd)
{
struct file *file = fget(fd);
- if (file == NULL)
+ if (!file)
return NULL;
if (file->f_op != &sync_fence_fops)
@@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name,
unsigned long size = offsetof(struct sync_fence, cbs[num_fences]);
fence = sync_fence_alloc(size, name);
- if (fence == NULL)
+ if (!fence)
return NULL;
atomic_set(&fence->status, num_fences);
@@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg)
}
fence2 = sync_fence_fdget(data.fd2);
- if (fence2 == NULL) {
+ if (!fence2) {
err = -ENOENT;
goto err_put_fd;
}
data.name[sizeof(data.name) - 1] = '\0';
fence3 = sync_fence_merge(data.name, fence, fence2);
- if (fence3 == NULL) {
+ if (!fence3) {
err = -ENOMEM;
goto err_put_fence2;
}
@@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence *fence,
size = 4096;
data = kzalloc(size, GFP_KERNEL);
- if (data == NULL)
+ if (!data)
return -ENOMEM;
strlcpy(data->name, fence->name, sizeof(data->name));
--
1.9.1
next prev parent reply other threads:[~2015-08-26 3:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 3:52 [PATCH 0/8] fix drivers/staging/android several coding style issues Peng Sun
2015-08-26 3:52 ` [PATCH 1/8] fix staging:android style issue:spaces preferred around that '-' Peng Sun
2015-08-26 3:52 ` [PATCH 2/8] fix staging:android style issue:No space is necessary after a cast Peng Sun
2015-08-26 3:52 ` [PATCH 3/8] fix staging:android style issue:Alignment should match open parenthesis Peng Sun
2015-08-26 3:52 ` [PATCH 4/8] fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t' Peng Sun
2015-08-26 3:52 ` [PATCH 5/8] fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations Peng Sun
2015-08-26 3:52 ` Peng Sun [this message]
2015-08-26 3:52 ` [PATCH 7/8] fix staging:android style issue:definition without comment Peng Sun
2015-08-26 3:52 ` [PATCH 8/8] fix staging:android style issue:Please don't use multiple blank lines Peng Sun
2015-08-26 9:29 ` [PATCH 3/8] fix staging:android style issue:Alignment should match open parenthesis Giedrius Statkevičius
2015-09-03 1:05 ` [PATCH 0/8] fix drivers/staging/android several coding style issues Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440561137-15574-7-git-send-email-sironhide0null@gmail.com \
--to=sironhide0null@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).