From 4daaabe451d205ed2367aa1d65246ff951f75d48 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 30 Jul 2021 16:43:08 +0100 Subject: [PATCH] trivial: Do not log a scary warning for the common case --- libfwupdplugin/fu-device-locker.c | 6 ++++-- libfwupdplugin/fu-self-test.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libfwupdplugin/fu-device-locker.c b/libfwupdplugin/fu-device-locker.c index 17bb1d01f..268979e7e 100644 --- a/libfwupdplugin/fu-device-locker.c +++ b/libfwupdplugin/fu-device-locker.c @@ -203,8 +203,10 @@ fu_device_locker_new_full (gpointer device, if (!self->open_func (device, error)) { g_autoptr(GError) error_local = NULL; if (!self->close_func (device, &error_local)) { - g_debug ("ignoring close error on aborted open: %s", - error_local->message); + if (!g_error_matches(error_local, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO)) { + g_debug("ignoring close error on aborted open: %s", + error_local->message); + } } return NULL; } diff --git a/libfwupdplugin/fu-self-test.c b/libfwupdplugin/fu-self-test.c index 98d3df1d6..21cbcda37 100644 --- a/libfwupdplugin/fu-self-test.c +++ b/libfwupdplugin/fu-self-test.c @@ -237,7 +237,7 @@ fu_device_open_refcount_func (void) g_assert_no_error (error); g_assert_true (ret); ret = fu_device_close (device, &error); - g_assert_error (error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL); + g_assert_error(error, FWUPD_ERROR, FWUPD_ERROR_NOTHING_TO_DO); g_assert_false (ret); }