On Thu, Sep 11, 2003 at 03:06:24PM +0200, Duncan Sands wrote:
> On Wednesday 10 September 2003 18:54, Greg KH wrote:
> > On Wed, Sep 10, 2003 at 12:52:45PM +0200, Duncan Sands wrote:
> > >  speedtch.c |    7 +------
> > >  1 files changed, 1 insertion(+), 6 deletions(-)
> > >
> > >
> > > diff -Nru a/drivers/usb/misc/speedtch.c b/drivers/usb/misc/speedtch.c
> > > --- a/drivers/usb/misc/speedtch.c Wed Sep 10 13:25:09 2003
> > > +++ b/drivers/usb/misc/speedtch.c Wed Sep 10 13:25:09 2003
> > > @@ -1293,14 +1293,9 @@
> > >
> > >  static int __init udsl_usb_init (void)
> > >  {
> > > - struct sk_buff *skb; /* dummy for sizeof */
> > > -
> > >   dbg ("udsl_usb_init: driver version " DRIVER_VERSION);
> > >
> > > - if (sizeof (struct udsl_control) > sizeof (skb->cb)) {
> > > -         printk (KERN_ERR __FILE__ ": unusable with this kernel!\n");
> > > -         return -EIO;
> > > - }
> > > + BUG_ON (sizeof (struct udsl_control) > sizeof (((struct sk_buff
> > > *)0)->cb));
> >
> > No, I will not take a patch that adds any new BUG* calls to the usb
> > code.  I know you already have some in this driver, and that really is
> > unacceptable.  Device drivers should not shut down a system if they can
> > help it at all.  The original code that returns an error code is
> > correct.
> 
> How about the patch below?

It's a bit nicer, if only because the compiler will optimize it away to
nothing :)

> > I will gladly take patches to remove the other calls to BUG_ON() in this
> > driver (hint...)
> 
> What is the right thing to do when an assertion fails?
> i.e. some condition that should never occur occurs.
> In such cases it is not always reasonable to muddle on...

If you are checking for something that you messed up for as a developer,
something like this is ok, as it doesn't affect anyone if you do not
mess up (see the compiler comment above.)  But if you are just checking
for a valid version of the compiler, or for compiler bugs, I wouldn't
worry about it at all.  That's what compiler.h is for mostly.

thanks,

greg k-h


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to