All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Krowiak <akrowiak@linux.ibm.com>
To: "Cédric Le Goater" <clg@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, Thomas Huth <thuth@redhat.com>,
	Zhenzhong Duan <zhenzhong.duan@intel.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>,
	Eric Farman <farman@linux.ibm.com>
Subject: Re: [PATCH 4/7] s390x/css: Make S390CCWDeviceClass::realize return bool
Date: Fri, 24 May 2024 09:14:42 -0400	[thread overview]
Message-ID: <8b8407de-4db3-45a6-be02-8a74df5cd9cd@linux.ibm.com> (raw)
In-Reply-To: <20240522170107.289532-5-clg@redhat.com>


On 5/22/24 1:01 PM, Cédric Le Goater wrote:
> 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().
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>


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


> ---
>   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(-)
>
> diff --git a/include/hw/s390x/s390-ccw.h b/include/hw/s390x/s390-ccw.h
> index 2c807ee3a1ae8d85460fe65be8a62c64f212fe4b..2e0a70998132070996d6b0d083b8ddba5b9b87dc 100644
> --- a/include/hw/s390x/s390-ccw.h
> +++ b/include/hw/s390x/s390-ccw.h
> @@ -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);
> diff --git a/hw/s390x/s390-ccw.c b/hw/s390x/s390-ccw.c
> index b3d14c61d732880a651edcf28a040ca723cb9f5b..3c0975055089c3629dd76ce2e1484a4ef66d8d41 100644
> --- a/hw/s390x/s390-ccw.c
> +++ b/hw/s390x/s390-ccw.c
> @@ -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)
> diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c
> index 2600e62e37238779800dc2b3a0bd315d7633017b..9a8e052711fe2f7c067c52808b2af30d0ebfee0c 100644
> --- a/hw/vfio/ccw.c
> +++ b/hw/vfio/ccw.c
> @@ -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;
>           }
>       }


  parent reply	other threads:[~2024-05-24 13:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 17:01 [PATCH 0/7] s390x/ccw: Error reporting cleanups Cédric Le Goater
2024-05-22 17:01 ` [PATCH 1/7] hw/s390x/ccw: Make s390_ccw_get_dev_info() return a bool Cédric Le Goater
2024-05-23  8:43   ` Duan, Zhenzhong
2024-05-24 13:13   ` Anthony Krowiak
2024-05-22 17:01 ` [PATCH 2/7] s390x/css: Make CCWDeviceClass::realize return bool Cédric Le Goater
2024-05-23  8:43   ` Duan, Zhenzhong
2024-05-24 13:14   ` Anthony Krowiak
2024-05-22 17:01 ` [PATCH 3/7] hw/s390x/ccw: Remove local Error variable from s390_ccw_realize() Cédric Le Goater
2024-05-23  8:44   ` Duan, Zhenzhong
2024-05-24 13:14   ` Anthony Krowiak
2024-05-22 17:01 ` [PATCH 4/7] s390x/css: Make S390CCWDeviceClass::realize return bool Cédric Le Goater
2024-05-23  8:45   ` Duan, Zhenzhong
2024-05-24 13:14   ` Anthony Krowiak [this message]
2024-05-22 17:01 ` [PATCH 5/7] vfio/ccw: Use the 'Error **errp' argument of vfio_ccw_realize() Cédric Le Goater
2024-05-23  8:45   ` Duan, Zhenzhong
2024-05-24 13:14   ` Anthony Krowiak
2024-05-22 17:01 ` [PATCH 6/7] vfio/ccw: Fix the missed unrealize() call in error path Cédric Le Goater
2024-05-23  8:52   ` Cédric Le Goater
2024-05-22 17:01 ` [PATCH 7/7] vfio/{ap, ccw}: Use warn_report_err() for IRQ notifier registration errors Cédric Le Goater
2024-05-23  8:45   ` Duan, Zhenzhong
2024-05-24 13:14   ` Anthony Krowiak
2024-05-23 20:27 ` [PATCH 0/7] s390x/ccw: Error reporting cleanups Eric Farman
2024-05-27  6:23 ` Thomas Huth
2024-05-27  6:43   ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8b8407de-4db3-45a6-be02-8a74df5cd9cd@linux.ibm.com \
    --to=akrowiak@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.