From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Juergen Schindele <schindele@nentec.de>
Cc: Paul Sokolovsky <pmiscml@gmail.com>,
linux-arm-kernel@lists.arm.linux.org.uk,
linux-kernel@vger.kernel.org
Subject: Re: [RFC, PATCH 1/3] gpiodev - API definitions
Date: Wed, 11 Apr 2007 08:42:14 +0100 [thread overview]
Message-ID: <20070411074214.GB3752@flint.arm.linux.org.uk> (raw)
In-Reply-To: <200704110847.01107.schindele@nentec.de>
On Wed, Apr 11, 2007 at 08:47:01AM +0200, Juergen Schindele wrote:
> Am Dienstag, 10. April 2007 23:30 schrieb Paul Sokolovsky:
> > +static inline int gpiodev_get_value(struct gpio *gpio)
> > +{
> > + struct gpiodev_ops *ops = gpio->gpio_dev->dev.platform_data;
>
> wouldn't it be more sure to verify if xxx function is NOT null
> before using it ?? Perhaps something like that
> BUG_ON(!ops->get);
>
> > + return ops->get(&gpio->gpio_dev->dev, gpio->gpio_no);
What does the BUG_ON buy us that oopsing due to a NULL pointer deref
doesn't? Both cases you end up with a register dump and backtrace.
In fact, on ARM the NULL pointer deref provides a more accurate
register dump and backtrace than BUG_ON() can ever do.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
next prev parent reply other threads:[~2007-04-11 7:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-10 21:30 Paul Sokolovsky
2007-04-11 0:30 ` Eric Miao
2007-04-11 2:11 ` Paul Sokolovsky
2007-04-11 6:47 ` Juergen Schindele
2007-04-11 7:42 ` Russell King [this message]
2007-04-12 14:31 ` Paul Sokolovsky
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=20070411074214.GB3752@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=pmiscml@gmail.com \
--cc=schindele@nentec.de \
/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