From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-devel@nongnu.org
Cc: alxndr@bu.edu, ashijeetacharya@gmail.com,
paul.durrant@citrix.com, armbru@redhat.com,
qemu-block@nongnu.org
Subject: Re: [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
Date: Tue, 17 Mar 2020 15:13:59 +0100 [thread overview]
Message-ID: <d340d29b-f99c-f192-c00d-c1af16a562e5@redhat.com> (raw)
In-Reply-To: <20200317125741.15301-1-vsementsov@virtuozzo.com>
On 3/17/20 1:57 PM, Vladimir Sementsov-Ogievskiy wrote:
> It's wrong to use same err object as errp parameter for several
> function calls without intermediate checking for error: we'll crash if
> try to set err object twice. Fix that.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>
> Forgive me for sending this into your series, but seems it is very
> appropriate.
>
> It's rephrasing of my
> [PATCH v9 03/10] hw/sd/ssi-sd: fix error handling in ssi_sd_realize
> for partI series but but without use of ERRP_AUTO_PROPAGATE.
>
> hw/sd/ssi-sd.c | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
> index 91db069212..829797b597 100644
> --- a/hw/sd/ssi-sd.c
> +++ b/hw/sd/ssi-sd.c
> @@ -255,13 +255,25 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
> carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
> if (dinfo) {
> qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
> + if (err) {
> + goto fail;
> + }
> }
> +
> object_property_set_bool(OBJECT(carddev), true, "spi", &err);
> + if (err) {
> + goto fail;
> + }
> +
> object_property_set_bool(OBJECT(carddev), true, "realized", &err);
> if (err) {
> - error_setg(errp, "failed to init SD card: %s", error_get_pretty(err));
> - return;
> + goto fail;
> }
> +
> + return;
> +
> +fail:
> + error_propagate_prepend(errp, err, "failed to init SD card: ");
> }
>
> static void ssi_sd_reset(DeviceState *dev)
>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
next prev parent reply other threads:[~2020-03-17 14:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 17:05 [PATCH 0/3] Minor error handling cleanups Markus Armbruster
2020-03-13 17:05 ` [PATCH 1/3] Use &error_abort instead of separate assert() Markus Armbruster
2020-03-13 17:37 ` Alexander Bulekov
2020-03-13 17:57 ` Eric Blake
2020-03-14 4:58 ` Markus Armbruster
2020-03-17 12:21 ` Vladimir Sementsov-Ogievskiy
2020-03-13 17:05 ` [PATCH 2/3] hw/misc/ivshmem: Use one Error * variable instead of two Markus Armbruster
2020-03-13 17:58 ` Eric Blake
2020-03-17 12:27 ` Vladimir Sementsov-Ogievskiy
2020-03-13 17:05 ` [PATCH 3/3] xen-block: " Markus Armbruster
2020-03-13 18:01 ` Eric Blake
2020-03-13 19:48 ` Philippe Mathieu-Daudé
2020-03-17 12:32 ` Vladimir Sementsov-Ogievskiy
2020-03-17 19:03 ` Markus Armbruster
2020-03-17 20:04 ` Vladimir Sementsov-Ogievskiy
2020-03-13 17:26 ` [PATCH 0/3] Minor error handling cleanups Peter Maydell
2020-03-17 12:57 ` [PATCH v10 4/3] hw/sd/ssi-sd: fix error handling in ssi_sd_realize Vladimir Sementsov-Ogievskiy
2020-03-17 14:13 ` Philippe Mathieu-Daudé [this message]
2020-03-17 15:13 ` Markus Armbruster
2020-03-17 15:39 ` Markus Armbruster
2020-03-17 16:34 ` [PATCH 0/3] Minor error handling cleanups Markus Armbruster
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=d340d29b-f99c-f192-c00d-c1af16a562e5@redhat.com \
--to=philmd@redhat.com \
--cc=alxndr@bu.edu \
--cc=armbru@redhat.com \
--cc=ashijeetacharya@gmail.com \
--cc=paul.durrant@citrix.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).