Cleanup error handling in open_channel
[ust.git] / libust / buffers.c
index e5a1db3962e542e44be1f43453579328a4dc3bad..4011b64310f6791d12318f7e41dc62cd9825a7f4 100644 (file)
@@ -319,13 +319,10 @@ static int open_channel(struct ust_channel *chan, size_t subbuf_size,
 
        return 0;
 
-       /* Jump directly inside the loop to close the buffers that were already
-        * opened. */
-       for(; i>=0; i--) {
-               close_buf(chan->buf[i]);
+       /* Error handling */
 error:
-               do {} while(0);
-       }
+       for(i--; i >= 0; i--)
+               close_buf(chan->buf[i]);
 
        pthread_mutex_unlock(&ust_buffers_channels_mutex);
        return -1;
@@ -655,6 +652,7 @@ static int unmap_buf_structs(struct ust_channel *chan)
                        PERROR("shmdt");
                }
        }
+       return 0;
 }
 
 /*
@@ -1242,6 +1240,10 @@ size_t ltt_write_event_header_slow(struct ust_channel *channel,
        case LTT_RFLAG_ID:
                header.id_time = 31 << LTT_TSC_BITS;
                break;
+       default:
+               WARN_ON_ONCE(1);
+               header.id_time = 0;
+               break;
        }
 
        header.id_time |= (u32)tsc & LTT_TSC_MASK;
This page took 0.023121 seconds and 4 git commands to generate.