From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de
Subject: [Qemu-devel] [PATCH 05/11] fdc: Reject unimplemented error actions
Date: Wed, 30 Jun 2010 13:55:36 +0200 [thread overview]
Message-ID: <1277898942-6501-6-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1277898942-6501-1-git-send-email-armbru@redhat.com>
drive_init() doesn't permit them for if=floppy, but that's worthless:
we get them via if=none and -global.
This can make device initialization fail. Since all callers of
fdctrl_init_isa() ignore its value, change it to die instead of
returning failure. Without this, some callers would ignore the
failure, and others would crash.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/fdc.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/hw/fdc.c b/hw/fdc.c
index 6c74878..2d50bd6 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -29,6 +29,7 @@
#include "hw.h"
#include "fdc.h"
+#include "qemu-error.h"
#include "qemu-timer.h"
#include "isa.h"
#include "sysbus.h"
@@ -1844,7 +1845,7 @@ static void fdctrl_result_timer(void *opaque)
}
/* Init functions */
-static void fdctrl_connect_drives(FDCtrl *fdctrl)
+static int fdctrl_connect_drives(FDCtrl *fdctrl)
{
unsigned int i;
FDrive *drive;
@@ -1852,12 +1853,24 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl)
for (i = 0; i < MAX_FD; i++) {
drive = &fdctrl->drives[i];
+ if (drive->bs) {
+ if (bdrv_get_on_error(drive->bs, 0) != BLOCK_ERR_STOP_ENOSPC) {
+ error_report("fdc doesn't support drive option werror");
+ return -1;
+ }
+ if (bdrv_get_on_error(drive->bs, 1) != BLOCK_ERR_REPORT) {
+ error_report("fdc doesn't support drive option rerror");
+ return -1;
+ }
+ }
+
fd_init(drive);
fd_revalidate(drive);
if (drive->bs) {
bdrv_set_removable(drive->bs, 1);
}
}
+ return 0;
}
FDCtrl *fdctrl_init_isa(DriveInfo **fds)
@@ -1871,8 +1884,7 @@ FDCtrl *fdctrl_init_isa(DriveInfo **fds)
if (fds[1]) {
qdev_prop_set_drive_nofail(&dev->qdev, "driveB", fds[1]->bdrv);
}
- if (qdev_init(&dev->qdev) < 0)
- return NULL;
+ qdev_init_nofail(&dev->qdev);
return &(DO_UPCAST(FDCtrlISABus, busdev, dev)->state);
}
@@ -1950,9 +1962,7 @@ static int fdctrl_init_common(FDCtrl *fdctrl)
if (fdctrl->dma_chann != -1)
DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl);
- fdctrl_connect_drives(fdctrl);
-
- return 0;
+ return fdctrl_connect_drives(fdctrl);
}
static int isabus_fdc_init1(ISADevice *dev)
--
1.6.6.1
next prev parent reply other threads:[~2010-06-30 11:55 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-30 11:55 [Qemu-devel] [PATCH 00/11] Still more block related fixes and cleanups Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 01/11] blockdev: Clean up how readonly persists across virtual media change Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 02/11] block migration: Fix test for read-only drive Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 03/11] raw-posix: Don't "try harder" for BDRV_TYPE_CDROM Markus Armbruster
2010-07-05 15:31 ` [Qemu-devel] " Kevin Wolf
2010-07-05 16:15 ` Markus Armbruster
2010-07-05 16:35 ` Kevin Wolf
2010-06-30 11:55 ` [Qemu-devel] [PATCH 04/11] scsi: Reject unimplemented error actions Markus Armbruster
2010-07-05 15:39 ` [Qemu-devel] " Kevin Wolf
2010-07-05 16:26 ` Markus Armbruster
2010-06-30 11:55 ` Markus Armbruster [this message]
2010-06-30 11:55 ` [Qemu-devel] [PATCH 06/11] qdev: Don't hw_error() in qdev_init_nofail() Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 07/11] ide: Improve error messages Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 08/11] ide: Replace IDEState members is_cdrom, is_cf by drive_kind Markus Armbruster
2010-07-05 16:00 ` [Qemu-devel] " Kevin Wolf
2010-07-06 12:38 ` Markus Armbruster
2010-07-06 12:50 ` Kevin Wolf
2010-06-30 11:55 ` [Qemu-devel] [PATCH 09/11] ide: Make ide_init_drive() return success Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 10/11] ide: Reject readonly drives unless CD-ROM Markus Armbruster
2010-06-30 11:55 ` [Qemu-devel] [PATCH 11/11] ide: Reject invalid CHS geometry Markus Armbruster
2010-07-05 16:08 ` [Qemu-devel] Re: [PATCH 00/11] Still more block related fixes and cleanups Kevin Wolf
2010-07-05 16:28 ` 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=1277898942-6501-6-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=hch@lst.de \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@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).