]> code.delx.au - pulseaudio/commitdiff
bluetooth: Set to off instead of failing module load
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 19 Oct 2012 08:11:27 +0000 (10:11 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Fri, 19 Oct 2012 15:32:24 +0000 (18:32 +0300)
If the profile setup fails during module load, the fallback should be
setting the profile to off, exactly as it is done in card_set_profile().

src/modules/bluetooth/module-bluetooth-device.c

index 8b14c6169882aa807b09806aacfa8c796f01c089..a907e4be3380f5379a0f3b5ef2b8948f7ec7a78a 100644 (file)
@@ -2647,11 +2647,18 @@ int pa__init(pa_module* m) {
 
     if (u->profile != PROFILE_OFF)
         if (init_profile(u) < 0)
-            goto fail;
+            goto off;
 
     if (u->sink || u->source)
         if (start_thread(u) < 0)
-            goto fail;
+            goto off;
+
+    return 0;
+
+off:
+    stop_thread(u);
+
+    pa_assert_se(pa_card_set_profile(u->card, "off", false) >= 0);
 
     return 0;