Revision c4d74df7

b/hw/ide/core.c
26 26
#include <hw/pc.h>
27 27
#include <hw/pci.h>
28 28
#include <hw/scsi.h>
29
#include "qemu-error.h"
29 30
#include "qemu-timer.h"
30 31
#include "sysemu.h"
31 32
#include "dma.h"
......
2594 2595
    ide_clear_hob(bus);
2595 2596
}
2596 2597

  
2597
void ide_init_drive(IDEState *s, BlockDriverState *bs,
2598
                    const char *version, const char *serial)
2598
int ide_init_drive(IDEState *s, BlockDriverState *bs,
2599
                   const char *version, const char *serial)
2599 2600
{
2600 2601
    int cylinders, heads, secs;
2601 2602
    uint64_t nb_sectors;
......
2630 2631
    }
2631 2632
    ide_reset(s);
2632 2633
    bdrv_set_removable(bs, s->drive_kind == IDE_CD);
2634
    return 0;
2633 2635
}
2634 2636

  
2635 2637
static void ide_init1(IDEBus *bus, int unit)
......
2669 2671
        dinfo = i == 0 ? hd0 : hd1;
2670 2672
        ide_init1(bus, i);
2671 2673
        if (dinfo) {
2672
            ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL,
2673
                           *dinfo->serial ? dinfo->serial : NULL);
2674
            if (ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL,
2675
                               *dinfo->serial ? dinfo->serial : NULL) < 0) {
2676
                error_report("Can't set up IDE drive %s", dinfo->id);
2677
                exit(1);
2678
            }
2674 2679
        } else {
2675 2680
            ide_reset(&bus->ifs[i]);
2676 2681
        }
b/hw/ide/internal.h
556 556
void ide_data_writel(void *opaque, uint32_t addr, uint32_t val);
557 557
uint32_t ide_data_readl(void *opaque, uint32_t addr);
558 558

  
559
void ide_init_drive(IDEState *s, BlockDriverState *bs,
560
                    const char *version, const char *serial);
559
int ide_init_drive(IDEState *s, BlockDriverState *bs,
560
                   const char *version, const char *serial);
561 561
void ide_init2(IDEBus *bus, qemu_irq irq);
562 562
void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0,
563 563
                                    DriveInfo *hd1, qemu_irq irq);
b/hw/ide/qdev.c
118 118
        }
119 119
    }
120 120

  
121
    ide_init_drive(s, dev->conf.bs, dev->version, serial);
121
    if (ide_init_drive(s, dev->conf.bs, dev->version, serial) < 0) {
122
        return -1;
123
    }
122 124

  
123 125
    if (!dev->version) {
124 126
        dev->version = qemu_strdup(s->version);

Also available in: Unified diff