[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070411074214.GB3752@flint.arm.linux.org.uk>
Date: Wed, 11 Apr 2007 08:42:14 +0100
From: Russell King <rmk+lkml@....linux.org.uk>
To: Juergen Schindele <schindele@...tec.de>
Cc: Paul Sokolovsky <pmiscml@...il.com>,
linux-arm-kernel@...ts.arm.linux.org.uk,
linux-kernel@...r.kernel.org
Subject: Re: [RFC, PATCH 1/3] gpiodev - API definitions
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:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists