From: John Snow <jsnow@redhat.com>
To: Eduardo Otubo <otubo@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] isa-fdc: assert replaced by proper error exit
Date: Fri, 1 Sep 2017 15:29:27 -0400 [thread overview]
Message-ID: <af65a01a-d4a5-e043-b222-87bbaf797d2a@redhat.com> (raw)
In-Reply-To: <20170901110706.429-1-otubo@redhat.com>
On 09/01/2017 07:07 AM, Eduardo Otubo wrote:
> When not available, isa-fdc falls into assert instead of proper error
> exit. This patch fixes this behavior.
>
> Signed-off-by: Eduardo Otubo <otubo@redhat.com>
> ---
> hw/block/fdc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
> index 401129073b..0b6def4e1d 100644
> --- a/hw/block/fdc.c
> +++ b/hw/block/fdc.c
> @@ -2699,11 +2699,15 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp)
> fdctrl->dma_chann = isa->dma;
> if (fdctrl->dma_chann != -1) {
> fdctrl->dma = isa_get_dma(isa_bus_from_device(isadev), isa->dma);
> - assert(fdctrl->dma);
> + if (!fdctrl->dma) {
> + error_setg(errp, "isa-fdc not supported");
> + goto error;
> + }
> }
>
> qdev_set_legacy_instance_id(dev, isa->iobase, 2);
> fdctrl_realize_common(dev, fdctrl, &err);
> +error:
> if (err != NULL) {
> error_propagate(errp, err);
> return;
>
I was going to ask if we needn't take care of undoing the portio or IRQ
registration, but it turns out that there is not one single caller of
portio_list_destroy in all of QEMU...
Paolo admitted as much in e3fb0ade83420a86464ee50c71f2daf5641cab10 when
he updated the destroy function :)
It looks like the way we assign IRQs to ISA devices is kind of simple
and not trivial to undo correctly, so instead of barking up that tree,
why don't we hoist the isa_get_dma call up and fail before we try to
initialize portio or IRQs?
prev parent reply other threads:[~2017-09-01 19:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-01 11:07 [Qemu-devel] [PATCH] isa-fdc: assert replaced by proper error exit Eduardo Otubo
2017-09-01 11:37 ` Thomas Huth
2017-09-01 13:02 ` Markus Armbruster
2017-09-01 19:29 ` John Snow [this message]
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=af65a01a-d4a5-e043-b222-87bbaf797d2a@redhat.com \
--to=jsnow@redhat.com \
--cc=otubo@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
/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).