On Tue, 6 Jan 2004, Duncan Sands wrote: > Hi Alan, if you check out the patch you will see that I concluded that all the > tests in question fell into case (2) and removed them. I think we both > agree about case (2). I guess there is some confusion about case (1). > If the result of not testing is that the driver oopses (and maybe can't > be used anymore), but the core is left in an OK state then that is case (2) > and not case (1). Case (1) is when the core will, for example, get into > an inconsistent state if the check is omitted. In that case testing is > necessary. If the test fails, a BUG may be quite appropriate.
You mean, case (1) is when the core will get into an inconsistent state without creating any visible indications (like an oops)? Then I agree that a BUG may be appropriate. If the core would oops without the test then a BUG won't make any difference. > Remember, > I was arguing against Dave's code bloat argument, and pointing out > when tests should not be removed (and maybe improved). I don't recall the context of the tests you were discussing before. But I'm seen too many cases of code like this (from core/hcd.c:hcd_alloc_dev): if (!udev || udev->hcpriv) return -EINVAL; if (!udev->bus || !udev->bus->hcpriv) return -ENODEV; with no explanation or comment about whether those tests are _ever_ supposed to fail, or what it would mean if they did. And remember also, drivers are part of the kernel. They're _supposed_ to be trustworthy. If the core tries to second-guess everything they do, it will never get any of its own work done. Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel