Skip to contentSkip to conversation

s390x/ccw: Error reporting cleanups

PATCH In review Cédric Le Goater 5 participants 24 messages May 22, 2024 – May 27, 2024

lore
Share & tools
lore
#0 lore raw

cover s390x/ccw: Error reporting cleanups

Hello,

The first patches of this series simply apply the practices described in the Rules section of the qapi/error.h file for routines taking an 'Error **' argument. The remaining patches are a fixup in the error path of vfio_ccw_realize() and some error reporting adjustements.

Applies on top of this vfio PR :

https://lore.kernel.org/qemu-devel/[email protected]

Thanks,

C.

Cédric Le Goater (6):
hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool s390x/css: Make CCWDeviceClass::realize return bool hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() s390x/css: Make S390CCWDeviceClass::realize return bool vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() vfio/{ap,ccw}: Use warn_report_err() for IRQ notifier registration
errors

Zhenzhong Duan (1):
vfio/ccw: Fix the missed unrealize() call in error path

 hw/s390x/ccw-device.h       |  2 +-
 include/hw/s390x/s390-ccw.h |  2 +-
 hw/s390x/ccw-device.c       |  3 ++-
 hw/s390x/s390-ccw.c         | 29 +++++++++++++----------------
 hw/vfio/ap.c                |  2 +-
 hw/vfio/ccw.c               | 18 ++++++++----------
 6 files changed, 26 insertions(+), 30 deletions(-)
Signature · 1 line
2.45.1
#1 lore raw

PATCH 1/7 hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool

Since s390_ccw_get_dev_info() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. While at it, modify the call in s390_ccw_realize().

---
 hw/s390x/s390-ccw.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/s390x/s390-ccw.c +6 -6
index 5261e66724f1cc3157b9413b0d5fdf5289c92503..a06e91dfb318e3500324851488c56806fa46c08d 100644
@@ -71,7 +71,7 @@ IOInstEnding s390_ccw_store(SubchDev *sch)
     return ret;
 }
 
-static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
+static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
                                   char *sysfsdev,
                                   Error **errp)
 {
@@ -84,12 +84,12 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
         error_setg(errp, "No host device provided");
         error_append_hint(errp,
                           "Use -device vfio-ccw,sysfsdev=PATH_TO_DEVICE\n");
-        return;
+        return false;
     }
 
     if (!realpath(sysfsdev, dev_path)) {
         error_setg_errno(errp, errno, "Host device '%s' not found", sysfsdev);
-        return;
+        return false;
     }
 
     cdev->mdevid = g_path_get_basename(dev_path);
@@ -98,13 +98,14 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
     tmp = g_path_get_basename(tmp_dir);
     if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {
         error_setg_errno(errp, errno, "Failed to read %s", tmp);
-        return;
+        return false;
     }
 
     cdev->hostid.cssid = cssid;
     cdev->hostid.ssid = ssid;
     cdev->hostid.devid = devid;
     cdev->hostid.valid = true;
+    return true;
 }
 
 static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
@@ -116,8 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     int ret;
     Error *err = NULL;
 
-    s390_ccw_get_dev_info(cdev, sysfsdev, &err);
-    if (err) {
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
         goto out_err_propagate;
     }
 
Signature · 1 line
2.45.1
Reviewed-by on v1 1/7
#2 lore raw

RE: [PATCH 1/7] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool

Quoted 7 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Subject: [PATCH 1/7] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool

Quoted 5 lines

Since s390_ccw_get_dev_info() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. While at it, modify the call in s390_ccw_realize().

Thanks
Zhenzhong

Quoted 66 lines

---
hw/s390x/s390-ccw.c | 12 ++++++------

1 file changed, 6 insertions(+), 6 deletions(-)
hw/s390x/s390-ccw.c +0 -0

index 5261e66724f1cc3157b9413b0d5fdf5289c92503..a06e91dfb318e35003248 51488c56806fa46c08d 100644

hw/s390x/s390-ccw.c +3 -3
@@ -71,7 +71,7 @@ IOInstEnding s390_ccw_store(SubchDev *sch)
    return ret;
 }
 
-static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
+static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
                                  char *sysfsdev,
                                  Error **errp)
 {
@@ -84,12 +84,12 @@ static void s390_ccw_get_dev_info(S390CCWDevice
 *cdev,
        error_setg(errp, "No host device provided");
        error_append_hint(errp,
                          "Use -device vfio-ccw,sysfsdev=PATH_TO_DEVICE\n");
-        return;
+        return false;
    }
 
    if (!realpath(sysfsdev, dev_path)) {
        error_setg_errno(errp, errno, "Host device '%s' not found", sysfsdev);
-        return;
+        return false;
    }
 
    cdev->mdevid = g_path_get_basename(dev_path);
hw/s390x/s390-ccw.c +2 -1
@@ -98,13 +98,14 @@ static void s390_ccw_get_dev_info(S390CCWDevice
 *cdev,
    tmp = g_path_get_basename(tmp_dir);
    if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {
        error_setg_errno(errp, errno, "Failed to read %s", tmp);
-        return;
+        return false;
    }
 
    cdev->hostid.cssid = cssid;
    cdev->hostid.ssid = ssid;
    cdev->hostid.devid = devid;
    cdev->hostid.valid = true;
+    return true;
 }
 

static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)

hw/s390x/s390-ccw.c +1 -3
@@ -116,8 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev,
 char *sysfsdev, Error **errp)
    int ret;
    Error *err = NULL;
 
-    s390_ccw_get_dev_info(cdev, sysfsdev, &err);
-    if (err) {
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
        goto out_err_propagate;
    }
 
--

2.45.1

Reviewed-by on v1 1/7
#3 lore raw

Re: [PATCH 1/7] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool

In reply to Cédric Le Goater
Quoted 5 lines · Cédric Le Goater

Since s390_ccw_get_dev_info() takes an 'Error **' argument, best practices suggest to return a bool. See the qapi/error.h Rules section. While at it, modify the call in s390_ccw_realize().

Quoted 58 lines
---
  hw/s390x/s390-ccw.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
hw/s390x/s390-ccw.c +6 -6
index 5261e66724f1cc3157b9413b0d5fdf5289c92503..a06e91dfb318e3500324851488c56806fa46c08d 100644
@@ -71,7 +71,7 @@ IOInstEnding s390_ccw_store(SubchDev *sch)
      return ret;
  }
 
-static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
+static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
                                    char *sysfsdev,
                                    Error **errp)
  {
@@ -84,12 +84,12 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
          error_setg(errp, "No host device provided");
          error_append_hint(errp,
                            "Use -device vfio-ccw,sysfsdev=PATH_TO_DEVICE\n");
-        return;
+        return false;
      }
 
      if (!realpath(sysfsdev, dev_path)) {
          error_setg_errno(errp, errno, "Host device '%s' not found", sysfsdev);
-        return;
+        return false;
      }
 
      cdev->mdevid = g_path_get_basename(dev_path);
@@ -98,13 +98,14 @@ static void s390_ccw_get_dev_info(S390CCWDevice *cdev,
      tmp = g_path_get_basename(tmp_dir);
      if (sscanf(tmp, "%2x.%1x.%4x", &cssid, &ssid, &devid) != 3) {
          error_setg_errno(errp, errno, "Failed to read %s", tmp);
-        return;
+        return false;
      }
 
      cdev->hostid.cssid = cssid;
      cdev->hostid.ssid = ssid;
      cdev->hostid.devid = devid;
      cdev->hostid.valid = true;
+    return true;
  }
 
  static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
@@ -116,8 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
      int ret;
      Error *err = NULL;
 
-    s390_ccw_get_dev_info(cdev, sysfsdev, &err);
-    if (err) {
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
          goto out_err_propagate;
      }
 
#4 lore raw

PATCH 2/7 s390x/css: Make CCWDeviceClass::realize return bool

In reply to Cédric Le Goater

Since the realize() handler of CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in s390_ccw_realize().

---
 hw/s390x/ccw-device.h | 2 +-
 hw/s390x/ccw-device.c | 3 ++-
 hw/s390x/s390-ccw.c   | 3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)
hw/s390x/ccw-device.h +1 -1
index 6dff95225df11c63f9b66975019026b215c8c448..5feeb0ee7a268b8709043b5bbc56b06e707a448d 100644
@@ -36,7 +36,7 @@ extern const VMStateDescription vmstate_ccw_dev;
 struct CCWDeviceClass {
     DeviceClass parent_class;
     void (*unplug)(HotplugHandler *, DeviceState *, Error **);
-    void (*realize)(CcwDevice *, Error **);
+    bool (*realize)(CcwDevice *, Error **);
     void (*refill_ids)(CcwDevice *);
 };
 
hw/s390x/ccw-device.c +2 -1
index fb8c1acc64d5002c861a4913f292d8346dbef192..a7d682e5af9ce90e7e2fad8c24b30e39328c7cf4 100644
@@ -31,9 +31,10 @@ static void ccw_device_refill_ids(CcwDevice *dev)
     dev->subch_id.valid = true;
 }
 
-static void ccw_device_realize(CcwDevice *dev, Error **errp)
+static bool ccw_device_realize(CcwDevice *dev, Error **errp)
 {
     ccw_device_refill_ids(dev);
+    return true;
 }
 
 static Property ccw_device_properties[] = {
hw/s390x/s390-ccw.c +1 -2
index a06e91dfb318e3500324851488c56806fa46c08d..4b8ede701df90949720262b6fc1b65f4e505e34d 100644
@@ -137,8 +137,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
         goto out_err;
     }
 
-    ck->realize(ccw_dev, &err);
-    if (err) {
+    if (!ck->realize(ccw_dev, &err)) {
         goto out_err;
     }
 
Signature · 1 line
2.45.1
Reviewed-by on v1 2/7
#5 lore raw

RE: [PATCH 2/7] s390x/css: Make CCWDeviceClass::realize return bool

Quoted 11 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Subject: [PATCH 2/7] s390x/css: Make CCWDeviceClass::realize return bool

Since the realize() handler of CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in s390_ccw_realize().

Thanks
Zhenzhong

Quoted 58 lines

---

hw/s390x/ccw-device.h | 2 +-
hw/s390x/ccw-device.c | 3 ++-
hw/s390x/s390-ccw.c   | 3 +--
3 files changed, 4 insertions(+), 4 deletions(-)
hw/s390x/ccw-device.h +0 -0

index 6dff95225df11c63f9b66975019026b215c8c448..5feeb0ee7a268b8709043b 5bbc56b06e707a448d 100644

hw/s390x/ccw-device.h +1 -1
@@ -36,7 +36,7 @@ extern const VMStateDescription vmstate_ccw_dev;
 struct CCWDeviceClass {
    DeviceClass parent_class;
    void (*unplug)(HotplugHandler *, DeviceState *, Error **);
-    void (*realize)(CcwDevice *, Error **);
+    bool (*realize)(CcwDevice *, Error **);
    void (*refill_ids)(CcwDevice *);
 };
 
hw/s390x/ccw-device.c +0 -0

index fb8c1acc64d5002c861a4913f292d8346dbef192..a7d682e5af9ce90e7e2fad8 c24b30e39328c7cf4 100644

hw/s390x/ccw-device.c +2 -1
@@ -31,9 +31,10 @@ static void ccw_device_refill_ids(CcwDevice *dev)
    dev->subch_id.valid = true;
 }
 
-static void ccw_device_realize(CcwDevice *dev, Error **errp)
+static bool ccw_device_realize(CcwDevice *dev, Error **errp)
 {
    ccw_device_refill_ids(dev);
+    return true;
 }
 
 static Property ccw_device_properties[] = {
hw/s390x/s390-ccw.c +0 -0

index a06e91dfb318e3500324851488c56806fa46c08d..4b8ede701df9094972026 2b6fc1b65f4e505e34d 100644

hw/s390x/s390-ccw.c +1 -3
@@ -137,8 +137,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev,
 char *sysfsdev, Error **errp)
        goto out_err;
    }
 
-    ck->realize(ccw_dev, &err);
-    if (err) {
+    if (!ck->realize(ccw_dev, &err)) {
        goto out_err;
    }
 
--

2.45.1

Reviewed-by on v1 2/7
#6 lore raw

Re: [PATCH 2/7] s390x/css: Make CCWDeviceClass::realize return bool

In reply to Cédric Le Goater
Quoted 5 lines · Cédric Le Goater

Since the realize() handler of CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in s390_ccw_realize().

Quoted 49 lines
---
  hw/s390x/ccw-device.h | 2 +-
  hw/s390x/ccw-device.c | 3 ++-
  hw/s390x/s390-ccw.c   | 3 +--
  3 files changed, 4 insertions(+), 4 deletions(-)
hw/s390x/ccw-device.h +1 -1
index 6dff95225df11c63f9b66975019026b215c8c448..5feeb0ee7a268b8709043b5bbc56b06e707a448d 100644
@@ -36,7 +36,7 @@ extern const VMStateDescription vmstate_ccw_dev;
  struct CCWDeviceClass {
      DeviceClass parent_class;
      void (*unplug)(HotplugHandler *, DeviceState *, Error **);
-    void (*realize)(CcwDevice *, Error **);
+    bool (*realize)(CcwDevice *, Error **);
      void (*refill_ids)(CcwDevice *);
  };
 
hw/s390x/ccw-device.c +2 -1
index fb8c1acc64d5002c861a4913f292d8346dbef192..a7d682e5af9ce90e7e2fad8c24b30e39328c7cf4 100644
@@ -31,9 +31,10 @@ static void ccw_device_refill_ids(CcwDevice *dev)
      dev->subch_id.valid = true;
  }
 
-static void ccw_device_realize(CcwDevice *dev, Error **errp)
+static bool ccw_device_realize(CcwDevice *dev, Error **errp)
  {
      ccw_device_refill_ids(dev);
+    return true;
  }
 
  static Property ccw_device_properties[] = {
hw/s390x/s390-ccw.c +1 -2
index a06e91dfb318e3500324851488c56806fa46c08d..4b8ede701df90949720262b6fc1b65f4e505e34d 100644
@@ -137,8 +137,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
          goto out_err;
      }
 
-    ck->realize(ccw_dev, &err);
-    if (err) {
+    if (!ck->realize(ccw_dev, &err)) {
          goto out_err;
      }
 
#7 lore raw

PATCH 3/7 hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()

In reply to Cédric Le Goater

Use the 'Error **errp' argument of s390_ccw_realize() instead and remove the error_propagate() call.

---
 hw/s390x/s390-ccw.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
hw/s390x/s390-ccw.c +5 -8
index 4b8ede701df90949720262b6fc1b65f4e505e34d..b3d14c61d732880a651edcf28a040ca723cb9f5b 100644
@@ -115,13 +115,12 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     DeviceState *parent = DEVICE(ccw_dev);
     SubchDev *sch;
     int ret;
-    Error *err = NULL;
 
-    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
-        goto out_err_propagate;
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
+        return;
     }
 
-    sch = css_create_sch(ccw_dev->devno, &err);
+    sch = css_create_sch(ccw_dev->devno, errp);
     if (!sch) {
         goto out_mdevid_free;
     }
@@ -132,12 +131,12 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     ccw_dev->sch = sch;
     ret = css_sch_build_schib(sch, &cdev->hostid);
     if (ret) {
-        error_setg_errno(&err, -ret, "%s: Failed to build initial schib",
+        error_setg_errno(errp, -ret, "%s: Failed to build initial schib",
                          __func__);
         goto out_err;
     }
 
-    if (!ck->realize(ccw_dev, &err)) {
+    if (!ck->realize(ccw_dev, errp)) {
         goto out_err;
     }
 
@@ -151,8 +150,6 @@ out_err:
     g_free(sch);
 out_mdevid_free:
     g_free(cdev->mdevid);
-out_err_propagate:
-    error_propagate(errp, err);
 }
 
 static void s390_ccw_unrealize(S390CCWDevice *cdev)
Signature · 1 line
2.45.1
Reviewed-by on v1 3/7
#8 lore raw

RE: [PATCH 3/7] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()

Quoted 11 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Subject: [PATCH 3/7] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()

Use the 'Error **errp' argument of s390_ccw_realize() instead and remove the error_propagate() call.

Thanks
Zhenzhong

Quoted 55 lines

---
hw/s390x/s390-ccw.c | 13 +++++--------

1 file changed, 5 insertions(+), 8 deletions(-)
hw/s390x/s390-ccw.c +0 -0

index 4b8ede701df90949720262b6fc1b65f4e505e34d..b3d14c61d732880a651ed cf28a040ca723cb9f5b 100644

hw/s390x/s390-ccw.c +3 -4
@@ -115,13 +115,12 @@ static void s390_ccw_realize(S390CCWDevice
 *cdev, char *sysfsdev, Error **errp)
    DeviceState *parent = DEVICE(ccw_dev);
    SubchDev *sch;
    int ret;
-    Error *err = NULL;
 
-    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
-        goto out_err_propagate;
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
+        return;
    }
 
-    sch = css_create_sch(ccw_dev->devno, &err);
+    sch = css_create_sch(ccw_dev->devno, errp);
    if (!sch) {
        goto out_mdevid_free;
    }
hw/s390x/s390-ccw.c +2 -2
@@ -132,12 +131,12 @@ static void s390_ccw_realize(S390CCWDevice
 *cdev, char *sysfsdev, Error **errp)
    ccw_dev->sch = sch;
    ret = css_sch_build_schib(sch, &cdev->hostid);
    if (ret) {
-        error_setg_errno(&err, -ret, "%s: Failed to build initial schib",
+        error_setg_errno(errp, -ret, "%s: Failed to build initial schib",
                         __func__);
        goto out_err;
    }
 
-    if (!ck->realize(ccw_dev, &err)) {
+    if (!ck->realize(ccw_dev, errp)) {
        goto out_err;
    }
@@ -151,8 +150,6 @@ out_err:
    g_free(sch);

out_mdevid_free:

    g_free(cdev->mdevid);
hw/s390x/s390-ccw.c +0 -2
-out_err_propagate:
-    error_propagate(errp, err);

}

static void s390_ccw_unrealize(S390CCWDevice *cdev) --
2.45.1

Reviewed-by on v1 3/7
#9 lore raw

Re: [PATCH 3/7] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize()

In reply to Cédric Le Goater
Quoted 4 lines · Cédric Le Goater

Use the 'Error **errp' argument of s390_ccw_realize() instead and remove the error_propagate() call.

Quoted 49 lines
---
  hw/s390x/s390-ccw.c | 13 +++++--------
  1 file changed, 5 insertions(+), 8 deletions(-)
hw/s390x/s390-ccw.c +5 -8
index 4b8ede701df90949720262b6fc1b65f4e505e34d..b3d14c61d732880a651edcf28a040ca723cb9f5b 100644
@@ -115,13 +115,12 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
      DeviceState *parent = DEVICE(ccw_dev);
      SubchDev *sch;
      int ret;
-    Error *err = NULL;
 
-    if (!s390_ccw_get_dev_info(cdev, sysfsdev, &err)) {
-        goto out_err_propagate;
+    if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
+        return;
      }
 
-    sch = css_create_sch(ccw_dev->devno, &err);
+    sch = css_create_sch(ccw_dev->devno, errp);
      if (!sch) {
          goto out_mdevid_free;
      }
@@ -132,12 +131,12 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
      ccw_dev->sch = sch;
      ret = css_sch_build_schib(sch, &cdev->hostid);
      if (ret) {
-        error_setg_errno(&err, -ret, "%s: Failed to build initial schib",
+        error_setg_errno(errp, -ret, "%s: Failed to build initial schib",
                           __func__);
          goto out_err;
      }
 
-    if (!ck->realize(ccw_dev, &err)) {
+    if (!ck->realize(ccw_dev, errp)) {
          goto out_err;
      }
 
@@ -151,8 +150,6 @@ out_err:
      g_free(sch);
  out_mdevid_free:
      g_free(cdev->mdevid);
-out_err_propagate:
-    error_propagate(errp, err);
  }
 
  static void s390_ccw_unrealize(S390CCWDevice *cdev)
#10 lore raw

PATCH 4/7 s390x/css: Make S390CCWDeviceClass::realize return bool

In reply to Cédric Le Goater

Since the realize() handler of S390CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in vfio_ccw_realize().

---
 include/hw/s390x/s390-ccw.h | 2 +-
 hw/s390x/s390-ccw.c         | 7 ++++---
 hw/vfio/ccw.c               | 3 +--
 3 files changed, 6 insertions(+), 6 deletions(-)
include/hw/s390x/s390-ccw.h +1 -1
index 2c807ee3a1ae8d85460fe65be8a62c64f212fe4b..2e0a70998132070996d6b0d083b8ddba5b9b87dc 100644
@@ -31,7 +31,7 @@ struct S390CCWDevice {
 
 struct S390CCWDeviceClass {
     CCWDeviceClass parent_class;
-    void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
+    bool (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
     void (*unrealize)(S390CCWDevice *dev);
     IOInstEnding (*handle_request) (SubchDev *sch);
     int (*handle_halt) (SubchDev *sch);
hw/s390x/s390-ccw.c +4 -3
index b3d14c61d732880a651edcf28a040ca723cb9f5b..3c0975055089c3629dd76ce2e1484a4ef66d8d41 100644
@@ -108,7 +108,7 @@ static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
     return true;
 }
 
-static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
+static bool s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
 {
     CcwDevice *ccw_dev = CCW_DEVICE(cdev);
     CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev);
@@ -117,7 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
     int ret;
 
     if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
-        return;
+        return false;
     }
 
     sch = css_create_sch(ccw_dev->devno, errp);
@@ -142,7 +142,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
 
     css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid,
                           parent->hotplugged, 1);
-    return;
+    return true;
 
 out_err:
     css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL);
@@ -150,6 +150,7 @@ out_err:
     g_free(sch);
 out_mdevid_free:
     g_free(cdev->mdevid);
+    return false;
 }
 
 static void s390_ccw_unrealize(S390CCWDevice *cdev)
hw/vfio/ccw.c +1 -2
index 2600e62e37238779800dc2b3a0bd315d7633017b..9a8e052711fe2f7c067c52808b2af30d0ebfee0c 100644
@@ -582,8 +582,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
     /* Call the class init function for subchannel. */
     if (cdc->realize) {
-        cdc->realize(cdev, vcdev->vdev.sysfsdev, &err);
-        if (err) {
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
             goto out_err_propagate;
         }
     }
Signature · 1 line
2.45.1
Reviewed-by on v1 4/7
#11 lore raw

RE: [PATCH 4/7] s390x/css: Make S390CCWDeviceClass::realize return bool

Quoted 7 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Subject: [PATCH 4/7] s390x/css: Make S390CCWDeviceClass::realize return bool

Quoted 5 lines

Since the realize() handler of S390CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in vfio_ccw_realize().

Thanks
Zhenzhong

Quoted 86 lines

---

include/hw/s390x/s390-ccw.h | 2 +-
hw/s390x/s390-ccw.c         | 7 ++++---
hw/vfio/ccw.c               | 3 +--
3 files changed, 6 insertions(+), 6 deletions(-)
include/hw/s390x/s390-ccw.h +0 -0

index 2c807ee3a1ae8d85460fe65be8a62c64f212fe4b..2e0a70998132070996d6b 0d083b8ddba5b9b87dc 100644

include/hw/s390x/s390-ccw.h +1 -1
@@ -31,7 +31,7 @@ struct S390CCWDevice {
 
 struct S390CCWDeviceClass {
    CCWDeviceClass parent_class;
-    void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
+    bool (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
    void (*unrealize)(S390CCWDevice *dev);
    IOInstEnding (*handle_request) (SubchDev *sch);
    int (*handle_halt) (SubchDev *sch);
hw/s390x/s390-ccw.c +0 -0

index b3d14c61d732880a651edcf28a040ca723cb9f5b..3c0975055089c3629dd76 ce2e1484a4ef66d8d41 100644

hw/s390x/s390-ccw.c +1 -1
@@ -108,7 +108,7 @@ static bool s390_ccw_get_dev_info(S390CCWDevice
 *cdev,
    return true;
 }
 
-static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error
 **errp)
+static bool s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error
 **errp)
{
    CcwDevice *ccw_dev = CCW_DEVICE(cdev);
    CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev);
hw/s390x/s390-ccw.c +1 -1
@@ -117,7 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev,
 char *sysfsdev, Error **errp)
    int ret;
 
    if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
-        return;
+        return false;
    }
 
    sch = css_create_sch(ccw_dev->devno, errp);
hw/s390x/s390-ccw.c +1 -1
@@ -142,7 +142,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev,
 char *sysfsdev, Error **errp)
 
    css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid,
                          parent->hotplugged, 1);
-    return;
+    return true;
 

out_err:

    css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL);
hw/s390x/s390-ccw.c +0 -0
@@ -150,6 +150,7 @@ out_err:
    g_free(sch);

out_mdevid_free:

    g_free(cdev->mdevid);

+ return false;
}

static void s390_ccw_unrealize(S390CCWDevice *cdev)

hw/vfio/ccw.c +0 -0

index 2600e62e37238779800dc2b3a0bd315d7633017b..9a8e052711fe2f7c067c 52808b2af30d0ebfee0c 100644

hw/vfio/ccw.c +1 -2
@@ -582,8 +582,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error
 **errp)
 
    /* Call the class init function for subchannel. */
    if (cdc->realize) {
-        cdc->realize(cdev, vcdev->vdev.sysfsdev, &err);
-        if (err) {
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
            goto out_err_propagate;
        }
    }

--
2.45.1

Reviewed-by on v1 4/7
#12 lore raw

Re: [PATCH 4/7] s390x/css: Make S390CCWDeviceClass::realize return bool

In reply to Cédric Le Goater
Quoted 5 lines · Cédric Le Goater

Since the realize() handler of S390CCWDeviceClass takes an 'Error **' argument, best practices suggest to return a bool. See the api/error.h Rules section. While at it, modify the call in vfio_ccw_realize().

Quoted 72 lines
---
  include/hw/s390x/s390-ccw.h | 2 +-
  hw/s390x/s390-ccw.c         | 7 ++++---
  hw/vfio/ccw.c               | 3 +--
  3 files changed, 6 insertions(+), 6 deletions(-)
include/hw/s390x/s390-ccw.h +1 -1
index 2c807ee3a1ae8d85460fe65be8a62c64f212fe4b..2e0a70998132070996d6b0d083b8ddba5b9b87dc 100644
@@ -31,7 +31,7 @@ struct S390CCWDevice {
 
  struct S390CCWDeviceClass {
      CCWDeviceClass parent_class;
-    void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
+    bool (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
      void (*unrealize)(S390CCWDevice *dev);
      IOInstEnding (*handle_request) (SubchDev *sch);
      int (*handle_halt) (SubchDev *sch);
hw/s390x/s390-ccw.c +4 -3
index b3d14c61d732880a651edcf28a040ca723cb9f5b..3c0975055089c3629dd76ce2e1484a4ef66d8d41 100644
@@ -108,7 +108,7 @@ static bool s390_ccw_get_dev_info(S390CCWDevice *cdev,
      return true;
  }
 
-static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
+static bool s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
  {
      CcwDevice *ccw_dev = CCW_DEVICE(cdev);
      CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev);
@@ -117,7 +117,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
      int ret;
 
      if (!s390_ccw_get_dev_info(cdev, sysfsdev, errp)) {
-        return;
+        return false;
      }
 
      sch = css_create_sch(ccw_dev->devno, errp);
@@ -142,7 +142,7 @@ static void s390_ccw_realize(S390CCWDevice *cdev, char *sysfsdev, Error **errp)
 
      css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid,
                            parent->hotplugged, 1);
-    return;
+    return true;
 
  out_err:
      css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL);
@@ -150,6 +150,7 @@ out_err:
      g_free(sch);
  out_mdevid_free:
      g_free(cdev->mdevid);
+    return false;
  }
 
  static void s390_ccw_unrealize(S390CCWDevice *cdev)
hw/vfio/ccw.c +1 -2
index 2600e62e37238779800dc2b3a0bd315d7633017b..9a8e052711fe2f7c067c52808b2af30d0ebfee0c 100644
@@ -582,8 +582,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
      /* Call the class init function for subchannel. */
      if (cdc->realize) {
-        cdc->realize(cdev, vcdev->vdev.sysfsdev, &err);
-        if (err) {
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
              goto out_err_propagate;
          }
      }
#13 lore raw

PATCH 5/7 vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()

In reply to Cédric Le Goater

The local error variable is kept for vfio_ccw_register_irq_notifier() because it is not considered as a failing condition. We will change how error reporting is done in following changes.

Remove the error_propagate() call.

---
 hw/vfio/ccw.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
hw/vfio/ccw.c +5 -7
index 9a8e052711fe2f7c067c52808b2af30d0ebfee0c..a468fa2342b97e0ee36bd5fb8443025cc90a0453 100644
@@ -582,8 +582,8 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
     /* Call the class init function for subchannel. */
     if (cdc->realize) {
-        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
-            goto out_err_propagate;
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, errp)) {
+            return;
         }
     }
 
@@ -596,17 +596,17 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
         goto out_attach_dev_err;
     }
 
-    if (!vfio_ccw_get_region(vcdev, &err)) {
+    if (!vfio_ccw_get_region(vcdev, errp)) {
         goto out_region_err;
     }
 
-    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, &err)) {
+    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, errp)) {
         goto out_io_notifier_err;
     }
 
     if (vcdev->crw_region) {
         if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX,
-                                            &err)) {
+                                            errp)) {
             goto out_irq_notifier_err;
         }
     }
@@ -634,8 +634,6 @@ out_attach_dev_err:
     if (cdc->unrealize) {
         cdc->unrealize(cdev);
     }
-out_err_propagate:
-    error_propagate(errp, err);
 }
 
 static void vfio_ccw_unrealize(DeviceState *dev)
Signature · 1 line
2.45.1
Reviewed-by on v1 5/7
#14 lore raw

RE: [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()

Quoted 7 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Subject: [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()

Quoted 8 lines

The local error variable is kept for vfio_ccw_register_irq_notifier() because it is not considered as a failing condition. We will change how error reporting is done in following changes.

Remove the error_propagate() call.

Thanks
Zhenzhong

Quoted 57 lines

---
hw/vfio/ccw.c | 12 +++++-------

1 file changed, 5 insertions(+), 7 deletions(-)
hw/vfio/ccw.c +0 -0

index 9a8e052711fe2f7c067c52808b2af30d0ebfee0c..a468fa2342b97e0ee36bd5f b8443025cc90a0453 100644

hw/vfio/ccw.c +5 -5
@@ -582,8 +582,8 @@ static void vfio_ccw_realize(DeviceState *dev, Error
 **errp)
 
    /* Call the class init function for subchannel. */
    if (cdc->realize) {
-        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
-            goto out_err_propagate;
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, errp)) {
+            return;
        }
    }
@@ -596,17 +596,17 @@ static void vfio_ccw_realize(DeviceState *dev,
 Error **errp)
        goto out_attach_dev_err;
    }
 
-    if (!vfio_ccw_get_region(vcdev, &err)) {
+    if (!vfio_ccw_get_region(vcdev, errp)) {
        goto out_region_err;
    }
 
-    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX,
 &err)) {
+    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX,
 errp)) {
        goto out_io_notifier_err;
    }
 
    if (vcdev->crw_region) {
        if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX,
-                                            &err)) {
+                                            errp)) {
            goto out_irq_notifier_err;
        }
    }
hw/vfio/ccw.c +0 -3
@@ -634,8 +634,6 @@ out_attach_dev_err:
    if (cdc->unrealize) {
        cdc->unrealize(cdev);
    }
-out_err_propagate:
-    error_propagate(errp, err);
 }
 
 static void vfio_ccw_unrealize(DeviceState *dev)
--

2.45.1

Reviewed-by on v1 5/7
#15 lore raw

Re: [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()

In reply to Cédric Le Goater
Quoted 8 lines · Cédric Le Goater

The local error variable is kept for vfio_ccw_register_irq_notifier() because it is not considered as a failing condition. We will change how error reporting is done in following changes.

Remove the error_propagate() call.

Quoted 49 lines
---
  hw/vfio/ccw.c | 12 +++++-------
  1 file changed, 5 insertions(+), 7 deletions(-)
hw/vfio/ccw.c +5 -7
index 9a8e052711fe2f7c067c52808b2af30d0ebfee0c..a468fa2342b97e0ee36bd5fb8443025cc90a0453 100644
@@ -582,8 +582,8 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
 
      /* Call the class init function for subchannel. */
      if (cdc->realize) {
-        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, &err)) {
-            goto out_err_propagate;
+        if (!cdc->realize(cdev, vcdev->vdev.sysfsdev, errp)) {
+            return;
          }
      }
 
@@ -596,17 +596,17 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
          goto out_attach_dev_err;
      }
 
-    if (!vfio_ccw_get_region(vcdev, &err)) {
+    if (!vfio_ccw_get_region(vcdev, errp)) {
          goto out_region_err;
      }
 
-    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, &err)) {
+    if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_IO_IRQ_INDEX, errp)) {
          goto out_io_notifier_err;
      }
 
      if (vcdev->crw_region) {
          if (!vfio_ccw_register_irq_notifier(vcdev, VFIO_CCW_CRW_IRQ_INDEX,
-                                            &err)) {
+                                            errp)) {
              goto out_irq_notifier_err;
          }
      }
@@ -634,8 +634,6 @@ out_attach_dev_err:
      if (cdc->unrealize) {
          cdc->unrealize(cdev);
      }
-out_err_propagate:
-    error_propagate(errp, err);
  }
 
  static void vfio_ccw_unrealize(DeviceState *dev)
#16 lore raw

PATCH 6/7 vfio/ccw: Fix the missed unrealize() call in error path

In reply to Cédric Le Goater

From: Zhenzhong Duan <[email protected]>

When get name failed, we should call unrealize() so that vfio_ccw_realize() is self contained.

Fixes 909a6254eda ("vfio/ccw: Make vfio cdev pre-openable by passing a file handle")
---
 hw/vfio/ccw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/vfio/ccw.c +2 -1
index a468fa2342b97e0ee36bd5fb8443025cc90a0453..36f2677a448c5e31523dcc3de7d973ec70e4a13c 100644
@@ -588,7 +588,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
     }
 
     if (!vfio_device_get_name(vbasedev, errp)) {
-        return;
+        goto out_unrealize;
     }
 
     if (!vfio_attach_device(cdev->mdevid, vbasedev,
@@ -631,6 +631,7 @@ out_region_err:
     vfio_detach_device(vbasedev);
 out_attach_dev_err:
     g_free(vbasedev->name);
+out_unrealize:
     if (cdc->unrealize) {
         cdc->unrealize(cdev);
     }
Signature · 1 line
2.45.1
author Reviewed-by on v1 6/7
#17 lore raw

Re: [PATCH 6/7] vfio/ccw: Fix the missed unrealize() call in error path

Quoted 7 lines · Cédric Le Goater

From: Zhenzhong Duan <[email protected]>

When get name failed, we should call unrealize() so that vfio_ccw_realize() is self contained.

Fixes 909a6254eda ("vfio/ccw: Make vfio cdev pre-openable by passing a file handle")

Thanks,

C.

Quoted 25 lines
---
  hw/vfio/ccw.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
hw/vfio/ccw.c +2 -1
index a468fa2342b97e0ee36bd5fb8443025cc90a0453..36f2677a448c5e31523dcc3de7d973ec70e4a13c 100644
@@ -588,7 +588,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
      }
 
      if (!vfio_device_get_name(vbasedev, errp)) {
-        return;
+        goto out_unrealize;
      }
 
      if (!vfio_attach_device(cdev->mdevid, vbasedev,
@@ -631,6 +631,7 @@ out_region_err:
      vfio_detach_device(vbasedev);
  out_attach_dev_err:
      g_free(vbasedev->name);
+out_unrealize:
      if (cdc->unrealize) {
          cdc->unrealize(cdev);
      }
#18 lore raw

PATCH 7/7 vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors

In reply to Cédric Le Goater

vfio_ccw_register_irq_notifier() and vfio_ap_register_irq_notifier() errors are currently reported using error_report_err(). Since they are not considered as failing conditions, using warn_report_err() is more appropriate.

---
 hw/vfio/ap.c  | 2 +-
 hw/vfio/ccw.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/vfio/ap.c +1 -1
index c12531a7886a2fe87598be0861fba5923bd2c206..0c4354e3e70169ec072e16da0919936647d1d351 100644
@@ -172,7 +172,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
          * Report this error, but do not make it a failing condition.
          * Lack of this IRQ in the host does not prevent normal operation.
          */
-        error_report_err(err);
+        warn_report_err(err);
     }
 
     return;
hw/vfio/ccw.c +1 -1
index 36f2677a448c5e31523dcc3de7d973ec70e4a13c..1f8e1272c7555cd0a770481d1ae92988f6e2e62e 100644
@@ -616,7 +616,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
          * Report this error, but do not make it a failing condition.
          * Lack of this IRQ in the host does not prevent normal operation.
          */
-        error_report_err(err);
+        warn_report_err(err);
     }
 
     return;
Signature · 1 line
2.45.1
Reviewed-by on v1 7/7
#19 lore raw

RE: [PATCH 7/7] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors

Quoted 7 lines

-----Original Message-----
From: Cédric Le Goater <[email protected]>
Subject: [PATCH 7/7] vfio/{ap,ccw}: Use warn_report_err() for IRQ notifier registration errors

Quoted 6 lines

vfio_ccw_register_irq_notifier() and vfio_ap_register_irq_notifier() errors are currently reported using error_report_err(). Since they are not considered as failing conditions, using warn_report_err() is more appropriate.

Thanks
Zhenzhong

Quoted 39 lines

---
hw/vfio/ap.c | 2 +-
hw/vfio/ccw.c | 2 +-

2 files changed, 2 insertions(+), 2 deletions(-)
hw/vfio/ap.c +0 -0

index c12531a7886a2fe87598be0861fba5923bd2c206..0c4354e3e70169ec072e1 6da0919936647d1d351 100644

hw/vfio/ap.c +1 -1
@@ -172,7 +172,7 @@ static void vfio_ap_realize(DeviceState *dev, Error
 **errp)
         * Report this error, but do not make it a failing condition.
         * Lack of this IRQ in the host does not prevent normal operation.
         */
-        error_report_err(err);
+        warn_report_err(err);
    }
 
    return;
hw/vfio/ccw.c +0 -0

index 36f2677a448c5e31523dcc3de7d973ec70e4a13c..1f8e1272c7555cd0a77048 1d1ae92988f6e2e62e 100644

hw/vfio/ccw.c +1 -1
@@ -616,7 +616,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error
 **errp)
         * Report this error, but do not make it a failing condition.
         * Lack of this IRQ in the host does not prevent normal operation.
         */
-        error_report_err(err);
+        warn_report_err(err);
    }
 
    return;

--
2.45.1

Reviewed-by on v1 7/7
#20 lore raw

Re: [PATCH 7/7] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors

In reply to Cédric Le Goater
Quoted 6 lines · Cédric Le Goater

vfio_ccw_register_irq_notifier() and vfio_ap_register_irq_notifier() errors are currently reported using error_report_err(). Since they are not considered as failing conditions, using warn_report_err() is more appropriate.

Quoted 31 lines
---
  hw/vfio/ap.c  | 2 +-
  hw/vfio/ccw.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
hw/vfio/ap.c +1 -1
index c12531a7886a2fe87598be0861fba5923bd2c206..0c4354e3e70169ec072e16da0919936647d1d351 100644
@@ -172,7 +172,7 @@ static void vfio_ap_realize(DeviceState *dev, Error **errp)
           * Report this error, but do not make it a failing condition.
           * Lack of this IRQ in the host does not prevent normal operation.
           */
-        error_report_err(err);
+        warn_report_err(err);
      }
 
      return;
hw/vfio/ccw.c +1 -1
index 36f2677a448c5e31523dcc3de7d973ec70e4a13c..1f8e1272c7555cd0a770481d1ae92988f6e2e62e 100644
@@ -616,7 +616,7 @@ static void vfio_ccw_realize(DeviceState *dev, Error **errp)
           * Report this error, but do not make it a failing condition.
           * Lack of this IRQ in the host does not prevent normal operation.
           */
-        error_report_err(err);
+        warn_report_err(err);
      }
 
      return;
Reviewed-by on the v1 series
#21 lore raw
In reply to Cédric Le Goater
Quoted 28 lines · Cédric Le Goater

Hello,

The first patches of this series simply apply the practices described in the Rules section of the qapi/error.h file for routines taking an 'Error **' argument. The remaining patches are a fixup in the error path of vfio_ccw_realize() and some error reporting adjustements.

Applies on top of this vfio PR :


https://lore.kernel.org/qemu-devel/[email protected]

Thanks,

C.

Cédric Le Goater (6):
  hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool s390x/css: Make CCWDeviceClass::realize return bool hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() s390x/css: Make S390CCWDeviceClass::realize return bool vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() vfio/{ap,ccw}: Use warn_report_err() for IRQ notifier registration errors

Zhenzhong Duan (1):
  vfio/ccw: Fix the missed unrealize() call in error path

Quoted 8 lines

 hw/s390x/ccw-device.h       |  2 +- include/hw/s390x/s390-ccw.h |  2 +- hw/s390x/ccw-device.c       |  3 ++- hw/s390x/s390-ccw.c         | 29 +++++++++++++---------------- hw/vfio/ap.c                |  2 +-
 hw/vfio/ccw.c               | 18 ++++++++----------

 6 files changed, 26 insertions(+), 30 deletions(-)
Reviewed-by on the v1 series
#22 lore raw
In reply to Cédric Le Goater
Quoted 15 lines · Cédric Le Goater

Hello,

The first patches of this series simply apply the practices described in the Rules section of the qapi/error.h file for routines taking an 'Error **' argument. The remaining patches are a fixup in the error path of vfio_ccw_realize() and some error reporting adjustements.

Applies on top of this vfio PR :

   https://lore.kernel.org/qemu-devel/[email protected]

Thanks,

C.

Quoted 8 lines

Cédric Le Goater (6):
hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool s390x/css: Make CCWDeviceClass::realize return bool hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() s390x/css: Make S390CCWDeviceClass::realize return bool vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() vfio/{ap,ccw}: Use warn_report_err() for IRQ notifier registration
errors

Series

author Applied
#23 lore raw
Quoted 25 lines · Thomas Huth
Quoted 15 lines · Cédric Le Goater

Hello,

The first patches of this series simply apply the practices described in the Rules section of the qapi/error.h file for routines taking an 'Error **' argument. The remaining patches are a fixup in the error path of vfio_ccw_realize() and some error reporting adjustements.

Applies on top of this vfio PR :

   https://lore.kernel.org/qemu-devel/[email protected]

Thanks,

C.

Quoted 8 lines

Cédric Le Goater (6):
   hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool s390x/css: Make CCWDeviceClass::realize return bool hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() s390x/css: Make S390CCWDeviceClass::realize return bool vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() vfio/{ap,ccw}: Use warn_report_err() for IRQ notifier registration errors

Quoted 3 lines

Series

Applied to vfio-next.

Thanks,

C.