Skip to content

Commit

Permalink
err.h: add (missing) unlikely() to IS_ERR_OR_NULL()
Browse files Browse the repository at this point in the history
IS_ERR_VALUE() already contains it and so we need to add this only to
the !ptr check.  That will allow users of IS_ERR_OR_NULL(), to not add
this compiler flag.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Viresh Kumar authored and Linus Torvalds committed Jan 16, 2016
1 parent da48d09 commit dfffa58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static inline bool __must_check IS_ERR(__force const void *ptr)

static inline bool __must_check IS_ERR_OR_NULL(__force const void *ptr)
{
return !ptr || IS_ERR_VALUE((unsigned long)ptr);
return unlikely(!ptr) || IS_ERR_VALUE((unsigned long)ptr);
}

/**
Expand Down

0 comments on commit dfffa58

Please sign in to comment.