diff mbox

[V1,Resend,01/10] err.h: add (missing) unlikely() to IS_ERR_OR_NULL()

Message ID 17637dc7c513452e3c1bd8b8a7e63bd22e57017f.1439375087.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar Aug. 12, 2015, 10:29 a.m. UTC
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>
---
 include/linux/err.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Viresh Kumar Oct. 7, 2015, 10:35 a.m. UTC | #1
Hi Jiri,

On 12-08-15, 15:59, Viresh Kumar wrote:
> 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>
> ---
>  include/linux/err.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/err.h b/include/linux/err.h
> index a729120644d5..56762ab41713 100644
> --- a/include/linux/err.h
> +++ b/include/linux/err.h
> @@ -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);
>  }

Thanks for applying rest of the patches, but this is the most
important one. Can you please apply this one as well ?
diff mbox

Patch

diff --git a/include/linux/err.h b/include/linux/err.h
index a729120644d5..56762ab41713 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -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);
 }
 
 /**