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

Cédric Le Goater posted 7 patches 6 months ago
Maintainers: Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>, Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>
[PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()
Posted by Cédric Le Goater 6 months ago
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.

Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/vfio/ccw.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
index 9a8e052711fe2f7c067c52808b2af30d0ebfee0c..a468fa2342b97e0ee36bd5fb8443025cc90a0453 100644
--- a/hw/vfio/ccw.c
+++ b/hw/vfio/ccw.c
@@ -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)
-- 
2.45.1


Re: [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()
Posted by Anthony Krowiak 6 months ago
On 5/22/24 1:01 PM, Cédric Le Goater wrote:
> 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.
>
> Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>


Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>


> ---
>   hw/vfio/ccw.c | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 9a8e052711fe2f7c067c52808b2af30d0ebfee0c..a468fa2342b97e0ee36bd5fb8443025cc90a0453 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -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)

RE: [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize()
Posted by Duan, Zhenzhong 6 months ago

>-----Original Message-----
>From: Cédric Le Goater <clg@redhat.com>
>Subject: [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of
>vfio_ccw_realize()
>
>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.
>
>Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>
>Signed-off-by: Cédric Le Goater <clg@redhat.com>

Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>

Thanks
Zhenzhong

>---
> hw/vfio/ccw.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
>diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
>index
>9a8e052711fe2f7c067c52808b2af30d0ebfee0c..a468fa2342b97e0ee36bd5f
>b8443025cc90a0453 100644
>--- a/hw/vfio/ccw.c
>+++ b/hw/vfio/ccw.c
>@@ -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)
>--
>2.45.1