From: Amerigo Wang <amwang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: torvalds@linux-foundation.org, Amerigo Wang <amwang@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Eric B Munson <emunson@mgebm.net>,
David Rientjes <rientjes@google.com>,
Dave Hansen <dave@linux.vnet.ibm.com>, Mel Gorman <mel@csn.ul.ie>,
Mike Frysinger <vapier@gentoo.org>,
David Howells <dhowells@redhat.com>,
Alexey Dobriyan <adobriyan@gmail.com>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 1/2] proc: Use IS_ERR_OR_NULL() helper
Date: Mon, 28 Mar 2011 15:07:31 +0800 [thread overview]
Message-ID: <1301296053-23589-1-git-send-email-amwang@redhat.com> (raw)
In-Reply-To: <4D90206E.1090307@redhat.com>
Use IS_ERR_OR_NULL() helper
Signed-off-by: Amerigo Wang <amwang@redhat.com>
---
fs/proc/task_mmu.c | 10 ++++++----
fs/proc/task_nommu.c | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 2e7addf..3c06570 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -124,7 +124,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
return ERR_PTR(-ESRCH);
mm = mm_for_maps(priv->task);
- if (!mm || IS_ERR(mm))
+ if (IS_ERR_OR_NULL(mm))
return mm;
down_read(&mm->mmap_sem);
@@ -182,7 +182,7 @@ static void m_stop(struct seq_file *m, void *v)
struct proc_maps_private *priv = m->private;
struct vm_area_struct *vma = v;
- if (!IS_ERR(vma))
+ if (!IS_ERR_OR_NULL(vma))
vma_stop(priv, vma);
if (priv->task)
put_task_struct(priv->task);
@@ -768,9 +768,11 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
goto out;
mm = mm_for_maps(task);
- ret = PTR_ERR(mm);
- if (!mm || IS_ERR(mm))
+ if (IS_ERR_OR_NULL(mm)) {
+ if (mm)
+ ret = PTR_ERR(mm);
goto out_task;
+ }
ret = -EINVAL;
/* file position must be aligned */
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
index 980de54..35e8b2a 100644
--- a/fs/proc/task_nommu.c
+++ b/fs/proc/task_nommu.c
@@ -202,7 +202,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
return ERR_PTR(-ESRCH);
mm = mm_for_maps(priv->task);
- if (!mm || IS_ERR(mm)) {
+ if (IS_ERR_OR_NULL(mm)) {
put_task_struct(priv->task);
priv->task = NULL;
return mm;
--
1.7.4
next prev parent reply other threads:[~2011-03-28 7:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-27 9:16 BUG: unable to handle kernel paging request Anca Emanuel
2011-03-27 15:37 ` Linus Torvalds
2011-03-27 16:00 ` Américo Wang
2011-03-27 17:44 ` Anca Emanuel
2011-03-27 17:52 ` Stephen Wilson
2011-03-28 3:46 ` [Patch] proc: check error pointer returned by m_start() Amerigo Wang
2011-03-28 3:58 ` Linus Torvalds
2011-03-28 5:02 ` Cong Wang
2011-03-28 5:26 ` [Patch V2] " Amerigo Wang
2011-03-28 5:45 ` Cong Wang
2011-03-28 7:07 ` Amerigo Wang [this message]
2011-03-28 7:07 ` [PATCH 2/2] proc: do cleanup in m_start() rather than m_stop() Amerigo Wang
2011-03-28 7:15 ` [PATCH 1/2] proc: Use IS_ERR_OR_NULL() helper Mike Frysinger
2011-03-28 5:46 ` [Patch V2] proc: check error pointer returned by m_start() Anca Emanuel
2011-03-28 5:49 ` Cong Wang
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=1301296053-23589-1-git-send-email-amwang@redhat.com \
--to=amwang@redhat.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=dhowells@redhat.com \
--cc=emunson@mgebm.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=rientjes@google.com \
--cc=torvalds@linux-foundation.org \
--cc=vapier@gentoo.org \
--cc=viro@zeniv.linux.org.uk \
/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
Powered by JetHome