kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: der.herr@hofr.at (Nicholas Mc Guire)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Coding style quesion
Date: Sat, 18 Jun 2016 08:44:39 +0000	[thread overview]
Message-ID: <20160618084439.GA3748@osadl.at> (raw)


HI !

 Stumbled across the somewhat inconsistent treatement of functions returning ERR_PTR()
 in the kernel with respect to coding style, while trying to write some static code 
 checks. The two forms which seem comon are:

                if (PTR_ERR(var) == -EINVAL) {
 and
                if (var == ERR_PTR(-EINVAL)) {

 of which I think the first is the intended construct.

 my understanding of ERR_PTR is that it is intended to be used in the form

                ret = ERR_PTR(-EINVAL);
                ...
                retrurn ret;
 or
                return ERR_PTR(-EINVAL);

 but not as in the second if() above - technically its the same thing
 Is there an "official" preference to the one or other form ? 

thx!
hofrat

                 reply	other threads:[~2016-06-18  8:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160618084439.GA3748@osadl.at \
    --to=der.herr@hofr.at \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).