Am Montag, 2. August 2004 14:25 schrieb Florian Echtler: > > > + } else do { > > > + > > > + // create a new image and check for success > > > + result = idmouse_create_image (dev); > > > + if (result) > > > + break; > > > + > > > + // increment our usage count for the driver > > > + ++dev->open; > > > + > > > + // save our object in the file's private structure > > > + file->private_data = dev; > > > + > > > + } while (0); > > > > What do you intend with that loop? > > If you want goto, use it, not break. > Okay, maybe it's a kludge. But goto is, too. In any case, the > most clear solution would be > > + if (result) { > + > + // unlock this device > + up(&dev->sem); > + > + // unlock the disconnect semaphore > + up(&disconnect_sem); > + return result; > + } > > Agreed?
No, absolutely not. Such a thing makes changing the locks a nightmare and leads to unmaintainable code in the long run. The clean solution is "goto error_abort;" that's the kernel way of simulating exceptions, if you will. Regards Oliver ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel