lkml.org 
[lkml]   [2018]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] err.h: document that PTR_ERR should only be used if IS_ERR returns true
On Mon, Oct 15, 2018 at 11:37:08AM +0200, Alessandro Rubini wrote:

> OTOH I admit you can compare any value with -EINVAL, after PTR_ERR.
> But in general you first detect the error condition and then split
> among error (or print a message according to the exact value.

if (IS_ERR(p) && PTR_ERR(p) == -ENOENT)
instead of
if (p == ERR_PTR(-ENOENT))

is ugly, obfuscating what's going on for no good reason and I'm going
to keep killing those every time I run into one...

\
 
 \ /
  Last update: 2018-10-16 20:07    [W:0.052 / U:4.392 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site