All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] a2dp: Fixed warn_unused_result warning
@ 2019-04-30 10:30 Michał Lowas-Rzechonek
  2019-04-30 12:41 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-04-30 10:30 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz

This used to break builds when using maintainer mode via
./bootstrap-configure:

profiles/audio/a2dp.c:1775:2: error: ignoring return value of
    ‘asprintf’, declared with attribute warn_unused_result
    [-Werror=unused-result]
  asprintf(&sep->path, "%s/sep%d",
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 profiles/audio/a2dp.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 8f141739c..5f5ad508d 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1772,8 +1772,15 @@ static void register_remote_sep(void *data, void *user_data)
 	if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL))
 		goto done;
 
-	asprintf(&sep->path, "%s/sep%d", device_get_path(chan->device),
-							avdtp_get_seid(rsep));
+	if (asprintf(&sep->path, "%s/sep%d",
+				device_get_path(chan->device),
+				avdtp_get_seid(rsep)) < 0) {
+		error("Could not allocate path for remote sep %s/sep%d",
+				device_get_path(chan->device),
+				avdtp_get_seid(rsep));
+		sep->path = NULL;
+		goto done;
+	}
 
 	if (g_dbus_register_interface(btd_get_dbus_connection(),
 				sep->path, MEDIA_ENDPOINT_INTERFACE,
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] a2dp: Fixed warn_unused_result warning
  2019-04-30 10:30 [PATCH v2] a2dp: Fixed warn_unused_result warning Michał Lowas-Rzechonek
@ 2019-04-30 12:41 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2019-04-30 12:41 UTC (permalink / raw)
  To: Michał Lowas-Rzechonek; +Cc: linux-bluetooth, Luiz Augusto von Dentz

Hi Michał,

On Tue, Apr 30, 2019 at 1:31 PM Michał Lowas-Rzechonek
<michal.lowas-rzechonek@silvair.com> wrote:
>
> This used to break builds when using maintainer mode via
> ./bootstrap-configure:
>
> profiles/audio/a2dp.c:1775:2: error: ignoring return value of
>     ‘asprintf’, declared with attribute warn_unused_result
>     [-Werror=unused-result]
>   asprintf(&sep->path, "%s/sep%d",
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  profiles/audio/a2dp.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
> index 8f141739c..5f5ad508d 100644
> --- a/profiles/audio/a2dp.c
> +++ b/profiles/audio/a2dp.c
> @@ -1772,8 +1772,15 @@ static void register_remote_sep(void *data, void *user_data)
>         if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL))
>                 goto done;
>
> -       asprintf(&sep->path, "%s/sep%d", device_get_path(chan->device),
> -                                                       avdtp_get_seid(rsep));
> +       if (asprintf(&sep->path, "%s/sep%d",
> +                               device_get_path(chan->device),
> +                               avdtp_get_seid(rsep)) < 0) {
> +               error("Could not allocate path for remote sep %s/sep%d",
> +                               device_get_path(chan->device),
> +                               avdtp_get_seid(rsep));
> +               sep->path = NULL;
> +               goto done;
> +       }
>
>         if (g_dbus_register_interface(btd_get_dbus_connection(),
>                                 sep->path, MEDIA_ENDPOINT_INTERFACE,
> --
> 2.19.1

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-30 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 10:30 [PATCH v2] a2dp: Fixed warn_unused_result warning Michał Lowas-Rzechonek
2019-04-30 12:41 ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.