Listing 5. Cleanup

if (skel->dev == NULL) {
     /* the device was unplugged before the file
        was released */
     minor_table[skel->minor] = NULL;
     if (skel->bulk_in_buffer != NULL)
         kfree (skel->bulk_in_buffer);
     if (skel->bulk_out_buffer != NULL)
         kfree (skel->bulk_out_buffer);
     if (skel->write_urb != NULL)
         usb_free_urb (skel->write_urb);
     kfree (skel);
     go to exit;
}