linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 6/6] AVRCP: Fix not checking for media_player_controller_create
Date: Sun, 23 Dec 2012 17:24:58 +0200	[thread overview]
Message-ID: <1356276298-13795-6-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1356276298-13795-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Now that the MediaPlayer1 interface is experimental the interface
registration may fail which return NULL, in that case there is no
point on register to any notifications.
---
 profiles/audio/avrcp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 4e3d31d..ce070cd 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -1987,6 +1987,11 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn,
 
 	count = pdu->params[1];
 
+	path = device_get_path(session->dev->btd_dev);
+	mp = media_player_controller_create(path);
+	if (mp == NULL)
+		return FALSE;
+
 	for (; count > 0; count--) {
 		uint8_t event = pdu->params[1 + count];
 
@@ -2001,8 +2006,6 @@ static gboolean avrcp_get_capabilities_resp(struct avctp *conn,
 		}
 	}
 
-	path = device_get_path(session->dev->btd_dev);
-	mp = media_player_controller_create(path);
 	media_player_set_callbacks(mp, &ct_cbs, player);
 	player->user_data = mp;
 	player->destroy = (GDestroyNotify) media_player_destroy;
-- 
1.7.11.7


      parent reply	other threads:[~2012-12-23 15:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-23 15:24 [PATCH BlueZ 1/6] gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL Luiz Augusto von Dentz
2012-12-23 15:24 ` [PATCH BlueZ 2/6] media: Enable RegisterPlayer and UnregisterPlayer methods as experimental Luiz Augusto von Dentz
2012-12-23 15:24 ` [PATCH BlueZ 3/6] gdbus: Introduce GDBusInterfaceFlags Luiz Augusto von Dentz
2012-12-23 16:09   ` Marcel Holtmann
2012-12-23 16:27     ` Luiz Augusto von Dentz
2012-12-23 16:30       ` Marcel Holtmann
2012-12-23 15:24 ` [PATCH BlueZ 4/6] gdbus: Call check_signals when sending signals with g_dbus_send_message Luiz Augusto von Dentz
2012-12-23 16:10   ` Marcel Holtmann
2012-12-23 16:31     ` Luiz Augusto von Dentz
2012-12-23 16:40       ` Marcel Holtmann
2012-12-23 15:24 ` [PATCH BlueZ 5/6] player: Enable MediaPlayer1 interface as experimental Luiz Augusto von Dentz
2012-12-23 15:24 ` Luiz Augusto von Dentz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1356276298-13795-6-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).