Re: [PATCH 6/6] proc: use IS_ERR_OR_NULL()

From: Hugh Dickins
Date: Wed Apr 11 2012 - 20:41:26 EST


On Wed, 11 Apr 2012, Cong Wang wrote:

> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> Signed-off-by: Cong Wang <xiyou.wangcong@xxxxxxxxx>

Whereas this one, I don't object, but I don't see it as an improvement.

> ---
> fs/proc/base.c | 2 +-
> fs/proc/task_mmu.c | 4 ++--
> fs/proc/task_nommu.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 2dff86b..a72a409 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -239,7 +239,7 @@ static int proc_pid_auxv(struct task_struct *task, char *buffer)
> {
> struct mm_struct *mm = mm_access(task, PTRACE_MODE_READ);
> int res = PTR_ERR(mm);
> - if (mm && !IS_ERR(mm)) {
> + if (!IS_ERR_OR_NULL(mm)) {
> unsigned int nwords = 0;
> do {
> nwords += 2;
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 03360a1..da4cf5f 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -126,7 +126,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
> return ERR_PTR(-ESRCH);
>
> mm = mm_access(priv->task, PTRACE_MODE_READ);
> - if (!mm || IS_ERR(mm))
> + if (IS_ERR_OR_NULL(mm))
> return mm;
> down_read(&mm->mmap_sem);
>
> @@ -916,7 +916,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
>
> mm = mm_access(task, PTRACE_MODE_READ);
> ret = PTR_ERR(mm);
> - if (!mm || IS_ERR(mm))
> + if (IS_ERR_OR_NULL(mm))
> goto out_free;
>
> pagemap_walk.pmd_entry = pagemap_pte_range;
> diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c
> index 1ccfa53..57ad3cf 100644
> --- a/fs/proc/task_nommu.c
> +++ b/fs/proc/task_nommu.c
> @@ -224,7 +224,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
> return ERR_PTR(-ESRCH);
>
> mm = mm_access(priv->task, PTRACE_MODE_READ);
> - if (!mm || IS_ERR(mm)) {
> + if (IS_ERR_OR_NULL(mm)) {
> put_task_struct(priv->task);
> priv->task = NULL;
> return mm;
> --
> 1.7.7.6
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/