lkml.org 
[lkml]   [2007]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-11 09:45    [W:0.049 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site