diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 1773f1d..866b8c6 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -499,7 +499,8 @@ up_device_get_history_sync (UpDevice *device, const gchar *type, guint timespec, NULL, &error_local); if (!ret) { - g_set_error (error, 1, 0, "GetHistory(%s,%i) on %s failed: %s", type, timespec, + if (error_local->message) + g_set_error (error, 1, 0, "GetHistory(%s,%i) on %s failed: %s", type, timespec, up_device_get_object_path (device), error_local->message); g_error_free (error_local); goto out; @@ -576,7 +577,8 @@ up_device_get_statistics_sync (UpDevice *device, const gchar *type, GCancellable NULL, &error_local); if (!ret) { - g_set_error (error, 1, 0, "GetStatistics(%s) on %s failed: %s", type, + if (error_local->message) + g_set_error (error, 1, 0, "GetStatistics(%s) on %s failed: %s", type, up_device_get_object_path (device), error_local->message); g_error_free (error_local); goto out; diff --git a/src/linux/up-device-wup.c b/src/linux/up-device-wup.c index 3adbaa7..fcbc46e 100644 --- a/src/linux/up-device-wup.c +++ b/src/linux/up-device-wup.c @@ -324,7 +324,8 @@ up_device_wup_coldplug (UpDevice *device) /* dummy read */ data = up_device_wup_read_command (wup); - g_debug ("data after clear %s", data); + if (data) + g_debug ("data after clear %s", data); /* shouldn't do anything */ up_device_wup_parse_command (wup, data); diff --git a/src/linux/up-enumerator-udev.c b/src/linux/up-enumerator-udev.c index e1b0456..99723a8 100644 --- a/src/linux/up-enumerator-udev.c +++ b/src/linux/up-enumerator-udev.c @@ -240,8 +240,8 @@ power_supply_add_helper (UpEnumeratorUdev *self, /* Fire relevant sibling events and insert into lookup table */ parent_id = device_parent_id (device); - g_debug ("device %s has parent id: %s", device_key, parent_id); if (parent_id) { + g_debug ("device %s has parent id: %s", device_key, parent_id); GPtrArray *devices = NULL; char *parent_id_key = NULL; int i; diff --git a/src/linux/up-input.c b/src/linux/up-input.c index db96a9e..7592ce6 100644 --- a/src/linux/up-input.c +++ b/src/linux/up-input.c @@ -222,7 +222,8 @@ up_input_coldplug (UpInput *input, GUdevDevice *d) /* convert to a bitmask */ num_bits = up_input_str_to_bitmask (contents, bitmask, sizeof (bitmask)); if ((num_bits == 0) || (num_bits >= SW_CNT)) { - g_debug ("invalid bitmask entry for %s", native_path); + if (native_path) + g_debug ("invalid bitmask entry for %s", native_path); ret = FALSE; goto out; } diff --git a/src/up-device-kbd-backlight.c b/src/up-device-kbd-backlight.c index b5944ab..658e95a 100644 --- a/src/up-device-kbd-backlight.c +++ b/src/up-device-kbd-backlight.c @@ -325,10 +325,11 @@ up_device_kbd_backlight_initable_init (GInitable *initable, if (klass->coldplug != NULL) { ret = klass->coldplug (device); if (!ret) { - g_debug ("failed to coldplug %s", native_path); - g_propagate_error (error, g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, - "Failed to coldplug %s", native_path)); - + if (native_path) { + g_debug ("failed to coldplug %s", native_path); + g_propagate_error (error, g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, + "Failed to coldplug %s", native_path)); + } return FALSE; } }