From: Lorenzo Stoakes Date: Wed, 25 Sep 2024 07:48:27 +0000 (+0100) Subject: procfs: prefer neater pointer error comparison X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b3b0001f12b55c2a678c0f6ed78a3e1265eb2819;p=users%2Fjedix%2Flinux-maple.git procfs: prefer neater pointer error comparison We can compare a pointer to a known error code via PTR_ERR(ptr) == -EINVAL or via ptr == ERR_PTR(-EINVAL) - the latter is neater and collects the macro and constant in one, so refactor to use this form in proc_mem_open(). Link: https://lkml.kernel.org/r/2fae1834-749a-45e1-8594-5e5979cf7103@lucifer.local Signed-off-by: Lorenzo Stoakes Suggested-by: Al Viro Cc: Arnd Bergmann Signed-off-by: Andrew Morton --- diff --git a/fs/proc/base.c b/fs/proc/base.c index fe31decc12b5..94112df5f2a2 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -841,7 +841,7 @@ struct mm_struct *proc_mem_open(struct inode *inode, unsigned int mode) put_task_struct(task); if (IS_ERR(mm)) - return PTR_ERR(mm) == -ESRCH ? NULL : mm; + return mm == ERR_PTR(-ESRCH) ? NULL : mm; /* ensure this mm_struct can't be freed */ mmgrab(mm);