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

Submitted by Frediano Ziglio on July 22, 2019, 11:15 a.m.

Details

Message ID 20190722111522.400-1-fziglio@redhat.com
State Accepted
Commit 60b9037c6910285065570b037c146c0252dbfd25
Headers show
Series "usb-device-manager: Do not give warnings for supported configuration" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 22, 2019, 11:15 a.m.
Signed-off-by: Frediano Ziglio <fziglio@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

Patch hide | download patch | download mbox

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");

Comments

ping

> 
> Signed-off-by: Frediano Ziglio <fziglio@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");