bluez: remove unnecessary goto

All goto fail happen before ret is set. ret must be NULL, and the only
thing the fail statement block does is return NULL. Replacing the jumps to
do this return directly.

CID #1311329
This commit is contained in:
Luis de Bethencourt 2015-07-08 12:16:35 +01:00
parent a01133dd8f
commit 7d08d56527

View file

@ -199,7 +199,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
value = gst_structure_get_value (structure, "mpegversion");
if (!value || !G_VALUE_HOLDS_INT (value)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to get mpegversion");
goto fail;
return NULL;
}
gst_caps_set_simple (caps, "mpegversion", G_TYPE_INT,
g_value_get_int (value), NULL);
@ -207,7 +207,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
value = gst_structure_get_value (structure, "channels");
if (!value || !G_VALUE_HOLDS_INT (value)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to get channels");
goto fail;
return NULL;
}
gst_caps_set_simple (caps, "channels", G_TYPE_INT,
g_value_get_int (value), NULL);
@ -215,7 +215,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
value = gst_structure_get_value (structure, "base-profile");
if (!value || !G_VALUE_HOLDS_STRING (value)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to get base-profile");
goto fail;
return NULL;
}
gst_caps_set_simple (caps, "base-profile", G_TYPE_STRING,
g_value_get_string (value), NULL);
@ -228,7 +228,7 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
value = gst_structure_get_value (structure, "rate");
if (!value || !G_VALUE_HOLDS_INT (value)) {
GST_ERROR_OBJECT (avdtpsrc, "Failed to get sample rate");
goto fail;
return NULL;
}
rate = g_value_get_int (value);
@ -245,12 +245,6 @@ gst_avdtp_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
}
return ret;
fail:
if (ret)
gst_caps_unref (ret);
return NULL;
}
static gboolean