Revision 751c6a17 hw/musicpal.c

b/hw/musicpal.c
1512 1512
    qemu_irq pic[32];
1513 1513
    DeviceState *dev;
1514 1514
    int i;
1515
    int index;
1516 1515
    unsigned long flash_size;
1516
    DriveInfo *dinfo;
1517 1517

  
1518 1518
    if (!cpu_model)
1519 1519
        cpu_model = "arm926";
......
1549 1549
                   serial_hds[1], 1);
1550 1550

  
1551 1551
    /* Register flash */
1552
    index = drive_get_index(IF_PFLASH, 0, 0);
1553
    if (index != -1) {
1554
        flash_size = bdrv_getlength(drives_table[index].bdrv);
1552
    dinfo = drive_get(IF_PFLASH, 0, 0);
1553
    if (dinfo) {
1554
        flash_size = bdrv_getlength(dinfo->bdrv);
1555 1555
        if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 &&
1556 1556
            flash_size != 32*1024*1024) {
1557 1557
            fprintf(stderr, "Invalid flash image size\n");
......
1564 1564
         * image is smaller than 32 MB.
1565 1565
         */
1566 1566
        pflash_cfi02_register(0-MP_FLASH_SIZE_MAX, qemu_ram_alloc(flash_size),
1567
                              drives_table[index].bdrv, 0x10000,
1567
                              dinfo->bdrv, 0x10000,
1568 1568
                              (flash_size + 0xffff) >> 16,
1569 1569
                              MP_FLASH_SIZE_MAX / flash_size,
1570 1570
                              2, 0x00BF, 0x236D, 0x0000, 0x0000,

Also available in: Unified diff