[pulseaudio-discuss] [PATCH] bluetooth: Add missing return statement.

Colin Guthrie gmane at colin.guthr.ie
Sun May 15 07:10:35 PDT 2011


'Twas brillig, and Tanu Kaskinen at 14/05/11 13:37 did gyre and gimble:
> ---
>  src/modules/bluetooth/module-bluetooth-device.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index 086fce9..ae522bc 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -1957,6 +1957,8 @@ static int sco_over_pcm_state_update(struct userdata *u, pa_bool_t changed) {
>  
>          return 0;
>      }
> +
> +    return 0;
>  }
>  
>  static pa_hook_result_t sink_state_changed_cb(pa_core *c, pa_sink *s, struct userdata *u) {

Took a slightly different approach with this one to tidy up the early
return code a little (quite subjective but I prefer to not use else's
when the end of the first if has a return...)

Cheers

Col

commit ce8b03bb26243f01623699a115a34706b1348b77
Author: Colin Guthrie <colin at mageia.org>
Date:   Sun May 15 15:05:44 2011 +0100

    bluetooth: Fix early return styling and add missing return value

    Thanks to Tanu Kaskinen for pointing out the missing return.

diff --git a/src/modules/bluetooth/module-bluetooth-device.c
b/src/modules/bluetooth/module-bluetooth-device.c
index 086fce9..1ff752a 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1936,10 +1936,11 @@ static int sco_over_pcm_state_update(struct
userdata *u, pa_bool_t changed) {

         if (u->transport)
             return bt_transport_acquire(u, TRUE);
-        else
-            return start_stream_fd(u);

-    } else if (changed) {
+        return start_stream_fd(u);
+    }
+
+    if (changed) {
         if (u->service_fd < 0 && u->stream_fd < 0)
             return 0;

@@ -1954,9 +1955,9 @@ static int sco_over_pcm_state_update(struct
userdata *u, pa_bool_t changed) {
             pa_close(u->service_fd);
             u->service_fd = -1;
         }
-
-        return 0;
     }
+
+    return 0;
 }

 static pa_hook_result_t sink_state_changed_cb(pa_core *c, pa_sink *s,
struct userdata *u) {


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list