提交 c4d74df7 编写于 作者: M Markus Armbruster 提交者: Kevin Wolf

ide: Make ide_init_drive() return success

It still always succeeds.  The next commits will add failures.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 cd8722bb
......@@ -26,6 +26,7 @@
#include <hw/pc.h>
#include <hw/pci.h>
#include <hw/scsi.h>
#include "qemu-error.h"
#include "qemu-timer.h"
#include "sysemu.h"
#include "dma.h"
......@@ -2594,7 +2595,7 @@ void ide_bus_reset(IDEBus *bus)
ide_clear_hob(bus);
}
void ide_init_drive(IDEState *s, BlockDriverState *bs,
int ide_init_drive(IDEState *s, BlockDriverState *bs,
const char *version, const char *serial)
{
int cylinders, heads, secs;
......@@ -2630,6 +2631,7 @@ void ide_init_drive(IDEState *s, BlockDriverState *bs,
}
ide_reset(s);
bdrv_set_removable(bs, s->drive_kind == IDE_CD);
return 0;
}
static void ide_init1(IDEBus *bus, int unit)
......@@ -2669,8 +2671,11 @@ void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
dinfo = i == 0 ? hd0 : hd1;
ide_init1(bus, i);
if (dinfo) {
ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL,
*dinfo->serial ? dinfo->serial : NULL);
if (ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL,
*dinfo->serial ? dinfo->serial : NULL) < 0) {
error_report("Can't set up IDE drive %s", dinfo->id);
exit(1);
}
} else {
ide_reset(&bus->ifs[i]);
}
......
......@@ -556,7 +556,7 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr);
void ide_data_writel(void *opaque, uint32_t addr, uint32_t val);
uint32_t ide_data_readl(void *opaque, uint32_t addr);
void ide_init_drive(IDEState *s, BlockDriverState *bs,
int ide_init_drive(IDEState *s, BlockDriverState *bs,
const char *version, const char *serial);
void ide_init2(IDEBus *bus, qemu_irq irq);
void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
......
......@@ -118,7 +118,9 @@ static int ide_drive_initfn(IDEDevice *dev)
}
}
ide_init_drive(s, dev->conf.bs, dev->version, serial);
if (ide_init_drive(s, dev->conf.bs, dev->version, serial) < 0) {
return -1;
}
if (!dev->version) {
dev->version = qemu_strdup(s->version);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册