execute the same code for failure of assign_all_jacks_automatically()
authormiko <miko@openbsd.org>
Thu, 6 Sep 2018 09:48:23 +0000 (09:48 +0000)
committermiko <miko@openbsd.org>
Thu, 6 Sep 2018 09:48:23 +0000 (09:48 +0000)
and attach_all_mididevs(). this ensures unbind_all_jacks() and
usbd_deactivate() happen for both cases.

ok ratchov@

sys/dev/usb/umidi.c

index 3f20e5f..1b5e60a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: umidi.c,v 1.46 2017/12/30 23:08:29 guenther Exp $     */
+/*     $OpenBSD: umidi.c,v 1.47 2018/09/06 09:48:23 miko Exp $ */
 /*     $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $      */
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -205,8 +205,10 @@ umidi_attach(struct device *parent, struct device *self, void *aux)
        }
        err = attach_all_mididevs(sc);
        if (err!=USBD_NORMAL_COMPLETION) {
+               unbind_all_jacks(sc);
                free_all_jacks(sc);
                free_all_endpoints(sc);
+               goto error;
        }
 
 #ifdef UMIDI_DEBUG