From: Grant Likely <grant.likely@secretlab.ca>
To: David Miller <davem@davemloft.net>
Cc: error27@gmail.com, jeremy.kerr@canonical.com,
afleming@freescale.com, jezz@sysmic.org,
devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch] of: check for IS_ERR()
Date: Fri, 26 Feb 2010 09:11:46 -0700 [thread overview]
Message-ID: <fa686aa41002260811p23c86396wcbcd4a32daf504b5@mail.gmail.com> (raw)
In-Reply-To: <20100226.015420.66646406.davem@davemloft.net>
On Fri, Feb 26, 2010 at 2:54 AM, David Miller <davem@davemloft.net> wrote:
> From: Dan Carpenter <error27@gmail.com>
> Date: Fri, 26 Feb 2010 12:49:41 +0300
>
>> get_phy_device() can return an ERR_PTR()
>>
>> Signed-off-by: Dan Carpenter <error27@gmail.com>
>> ---
>> I don't have a cross compile environment set up so I can't even compile
>> test this. :/ But err.h is included so it should be OK.
>
> It should return ERR_PTR() consistently. Checking for both
> NULL and ERR_PTR() is undesirable.
Ugh. This is why I dislike the ERR_PTR() pattern so much. The
compiler cannot do any type checking and it is implemented
inconsistently. You have to go look at the calling function to find
out what you're allowed to do with the return value. ie. which test
do I use? (!ptr) or IS_ERR(ptr)?
It would be better if ERR_PTR() returned a structure or a union. At
least that way the compiler would yell at you if the an ERR_PTR was
being returned.
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2010-02-26 16:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 9:49 Dan Carpenter
2010-02-26 9:54 ` David Miller
2010-02-26 16:11 ` Grant Likely [this message]
2010-03-29 15:41 ` Dan Carpenter
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=fa686aa41002260811p23c86396wcbcd4a32daf504b5@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=afleming@freescale.com \
--cc=davem@davemloft.net \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=error27@gmail.com \
--cc=jeremy.kerr@canonical.com \
--cc=jezz@sysmic.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome