All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Omit MainChannel when HDP first reliable channel is nil
@ 2012-03-27 13:03 Elvis Pfützenreuter
  2012-03-28  9:39 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Elvis Pfützenreuter @ 2012-03-27 13:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: epx

Do not add MainChannel to property list when HDP first reliable channel
does not exist. Upon channel destruction, ChannelDeleted signal is already
emitted.

This also fixes a crash where MainChannel was filled with invalid path ""
when first reliable channel did not exist.
---
 health/hdp.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/health/hdp.c b/health/hdp.c
index 812352f..455240c 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -723,14 +723,8 @@ static void health_channel_destroy(void *data)
 					DBUS_TYPE_INVALID);
 
 	if (hdp_chan == dev->fr) {
-		char *empty_path;
-
 		hdp_channel_unref(dev->fr);
 		dev->fr = NULL;
-		empty_path = "/";
-		emit_property_changed(dev->conn, device_get_path(dev->dev),
-					HEALTH_DEVICE, "MainChannel",
-					DBUS_TYPE_OBJECT_PATH, &empty_path);
 	}
 
 end:
@@ -2061,7 +2055,6 @@ static DBusMessage *device_get_properties(DBusConnection *conn,
 	struct hdp_device *device = user_data;
 	DBusMessageIter iter, dict;
 	DBusMessage *reply;
-	char *path;
 
 	reply = dbus_message_new_method_return(msg);
 	if (reply == NULL)
@@ -2075,11 +2068,9 @@ static DBusMessage *device_get_properties(DBusConnection *conn,
 			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
 
 	if (device->fr != NULL)
-		path = g_strdup(device->fr->path);
-	else
-		path = g_strdup("");
-	dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH, &path);
-	g_free(path);
+		dict_append_entry(&dict, "MainChannel", DBUS_TYPE_OBJECT_PATH,
+							&device->fr->path);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
-- 
1.7.5.4


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

* Re: [PATCH v2] Omit MainChannel when HDP first reliable channel is nil
  2012-03-27 13:03 [PATCH v2] Omit MainChannel when HDP first reliable channel is nil Elvis Pfützenreuter
@ 2012-03-28  9:39 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-03-28  9:39 UTC (permalink / raw)
  To: Elvis Pfützenreuter; +Cc: linux-bluetooth

Hi Elvis,

On Tue, Mar 27, 2012, Elvis Pfützenreuter wrote:
> Do not add MainChannel to property list when HDP first reliable channel
> does not exist. Upon channel destruction, ChannelDeleted signal is already
> emitted.
> 
> This also fixes a crash where MainChannel was filled with invalid path ""
> when first reliable channel did not exist.
> ---
>  health/hdp.c |   15 +++------------
>  1 files changed, 3 insertions(+), 12 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2012-03-28  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 13:03 [PATCH v2] Omit MainChannel when HDP first reliable channel is nil Elvis Pfützenreuter
2012-03-28  9:39 ` Johan Hedberg

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.