All of lore.kernel.org
 help / color / mirror / Atom feed
* + errh-add-helper-function-to-simplify-pointer-error-checking.patch added to -mm tree
@ 2009-09-29 19:15 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2009-09-29 19:15 UTC (permalink / raw)
  To: mm-commits; +Cc: ext-phil.2.carmody


The patch titled
     err.h: add helper function to simplify pointer error checking
has been added to the -mm tree.  Its filename is
     errh-add-helper-function-to-simplify-pointer-error-checking.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: err.h: add helper function to simplify pointer error checking
From: Phil Carmody <ext-phil.2.carmody@nokia.com>

There are quite a few instances in the kernel of checks of pointers both
against NULL and against the errno range, handling both cases identically.
This additional helper function would simplify such code.

Signed-off-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/err.h |    5 +++++
 1 file changed, 5 insertions(+)

diff -puN include/linux/err.h~errh-add-helper-function-to-simplify-pointer-error-checking include/linux/err.h
--- a/include/linux/err.h~errh-add-helper-function-to-simplify-pointer-error-checking
+++ a/include/linux/err.h
@@ -34,6 +34,11 @@ static inline long IS_ERR(const void *pt
 	return IS_ERR_VALUE((unsigned long)ptr);
 }
 
+static inline long IS_ERR_OR_NULL(const void *ptr)
+{
+	return (ptr == NULL) || IS_ERR_VALUE((unsigned long)ptr);
+}
+
 /**
  * ERR_CAST - Explicitly cast an error-valued pointer to another pointer type
  * @ptr: The pointer to cast.
_

Patches currently in -mm which might be from ext-phil.2.carmody@nokia.com are

errh-add-helper-function-to-simplify-pointer-error-checking.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-29 19:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-29 19:15 + errh-add-helper-function-to-simplify-pointer-error-checking.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.