[Spice-devel] [PATCH spice-gtk v2] usb-device-manager: Do not give warnings for supported configuration

Frediano Ziglio fziglio at redhat.com
Mon Jul 22 11:15:22 UTC 2019


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 src/usb-device-manager.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Changes since v1:
- conver a debug into warning to inform the user at least one time

diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 9aba275f..a38e3c0d 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -243,7 +243,7 @@ static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
     if (usbdk_is_driver_installed()) {
         priv->usbdk_api = usbdk_api_load();
     } else {
-        spice_debug("UsbDk driver is not installed");
+        g_warning("UsbDk driver is not installed");
     }
 #endif
 #ifdef USE_USBREDIR
@@ -1668,7 +1668,9 @@ gboolean _usbdk_hider_prepare(SpiceUsbDeviceManager *manager)
 {
     SpiceUsbDeviceManagerPrivate *priv = manager->priv;
 
-    g_return_val_if_fail(priv->usbdk_api != NULL, FALSE);
+    if (priv->usbdk_api == NULL) {
+        return FALSE;
+    }
 
     if (priv->usbdk_hider_handle == NULL) {
         priv->usbdk_hider_handle = usbdk_create_hider_handle(priv->usbdk_api);
@@ -1686,7 +1688,9 @@ void _usbdk_hider_clear(SpiceUsbDeviceManager *manager)
 {
     SpiceUsbDeviceManagerPrivate *priv = manager->priv;
 
-    g_return_if_fail(priv->usbdk_api != NULL);
+    if (priv->usbdk_api == NULL) {
+        return;
+    }
 
     if (priv->usbdk_hider_handle != NULL) {
         usbdk_clear_hide_rules(priv->usbdk_api, priv->usbdk_hider_handle);
@@ -1700,7 +1704,9 @@ void _usbdk_hider_update(SpiceUsbDeviceManager *manager)
 {
     SpiceUsbDeviceManagerPrivate *priv = manager->priv;
 
-    g_return_if_fail(priv->usbdk_api != NULL);
+    if (priv->usbdk_api == NULL) {
+        return;
+    }
 
     if (priv->auto_connect_filter == NULL) {
         SPICE_DEBUG("No autoredirect rules, no hider setup needed");
-- 
2.20.1



More information about the Spice-devel mailing list