From 7d08d565273b9a3d21d5c080b8c4770d0b91a5ed Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Wed, 8 Jul 2015 12:16:35 +0100 Subject: [PATCH] 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 --- sys/bluez/gstavdtpsrc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/bluez/gstavdtpsrc.c b/sys/bluez/gstavdtpsrc.c index 176c2d4d04..fee55053b5 100644 --- a/sys/bluez/gstavdtpsrc.c +++ b/sys/bluez/gstavdtpsrc.c @@ -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