diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/block/nand.c | 33 | ||||
-rw-r--r-- | hw/display/qxl.c | 1 | ||||
-rw-r--r-- | hw/i386/kvm/pci-assign.c | 1 | ||||
-rw-r--r-- | hw/sd/milkymist-memcard.c | 2 | ||||
-rw-r--r-- | hw/sd/omap_mmc.c | 4 | ||||
-rw-r--r-- | hw/sd/pl181.c | 2 | ||||
-rw-r--r-- | hw/sd/pxa2xx_mmci.c | 2 | ||||
-rw-r--r-- | hw/sd/sdhci.c | 2 | ||||
-rw-r--r-- | hw/sd/ssi-sd.c | 2 |
9 files changed, 27 insertions, 22 deletions
diff --git a/hw/block/nand.c b/hw/block/nand.c index 087ca14ed1..43401a0b1b 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -298,10 +298,8 @@ static void nand_command(NANDFlashState *s) case NAND_CMD_BLOCKERASE2: s->addr &= (1ull << s->addrlen * 8) - 1; - if (nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP) - s->addr <<= 16; - else - s->addr <<= 8; + s->addr <<= nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP ? + 16 : 8; if (s->wp) { s->blk_erase(s); @@ -464,10 +462,11 @@ void nand_setpins(DeviceState *dev, uint8_t cle, uint8_t ale, s->ce = ce; s->wp = wp; s->gnd = gnd; - if (wp) + if (wp) { s->status |= NAND_IOSTATUS_UNPROTCT; - else + } else { s->status &= ~NAND_IOSTATUS_UNPROTCT; + } } void nand_getpins(DeviceState *dev, int *rb) @@ -489,13 +488,12 @@ void nand_setio(DeviceState *dev, uint32_t value) return; } } - if (value == NAND_CMD_READ0) + if (value == NAND_CMD_READ0) { s->offset = 0; - else if (value == NAND_CMD_READ1) { + } else if (value == NAND_CMD_READ1) { s->offset = 0x100; value = NAND_CMD_READ0; - } - else if (value == NAND_CMD_READ2) { + } else if (value == NAND_CMD_READ2) { s->offset = 1 << s->page_shift; value = NAND_CMD_READ0; } @@ -508,8 +506,9 @@ void nand_setio(DeviceState *dev, uint32_t value) s->cmd == NAND_CMD_BLOCKERASE2 || s->cmd == NAND_CMD_NOSERIALREAD2 || s->cmd == NAND_CMD_RANDOMREAD2 || - s->cmd == NAND_CMD_RESET) + s->cmd == NAND_CMD_RESET) { nand_command(s); + } if (s->cmd != NAND_CMD_RANDOMREAD2) { s->addrlen = 0; @@ -596,8 +595,9 @@ uint32_t nand_getio(DeviceState *dev) s->iolen = (1 << s->page_shift) + (1 << s->oob_shift) - offset; } - if (s->ce || s->iolen <= 0) + if (s->ce || s->iolen <= 0) { return 0; + } for (offset = s->buswidth; offset--;) { x |= s->ioaddr[offset] << (offset << 3); @@ -696,8 +696,9 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s) uint8_t iobuf[0x200] = { [0 ... 0x1ff] = 0xff, }; addr = s->addr & ~((1 << (ADDR_SHIFT + s->erase_shift)) - 1); - if (PAGE(addr) >= s->pages) + if (PAGE(addr) >= s->pages) { return; + } if (!s->bdrv) { memset(s->storage + PAGE_START(addr), @@ -725,11 +726,12 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s) memset(iobuf, 0xff, 0x200); i = (addr & ~0x1ff) + 0x200; for (addr += ((PAGE_SIZE + OOB_SIZE) << s->erase_shift) - 0x200; - i < addr; i += 0x200) + i < addr; i += 0x200) { if (bdrv_write(s->bdrv, i >> 9, iobuf, 1) < 0) { printf("%s: write error in sector %" PRIu64 "\n", __func__, i >> 9); } + } page = i >> 9; if (bdrv_read(s->bdrv, page, iobuf, 1) < 0) { @@ -745,8 +747,9 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s) static void glue(nand_blk_load_, PAGE_SIZE)(NANDFlashState *s, uint64_t addr, int offset) { - if (PAGE(addr) >= s->pages) + if (PAGE(addr) >= s->pages) { return; + } if (s->bdrv) { if (s->mem_oob) { diff --git a/hw/display/qxl.c b/hw/display/qxl.c index c475cb10dc..937a402b2e 100644 --- a/hw/display/qxl.c +++ b/hw/display/qxl.c @@ -387,6 +387,7 @@ static void init_qxl_ram(PCIQXLDevice *d) d->ram->int_pending = cpu_to_le32(0); d->ram->int_mask = cpu_to_le32(0); d->ram->update_surface = 0; + d->ram->monitors_config = 0; SPICE_RING_INIT(&d->ram->cmd_ring); SPICE_RING_INIT(&d->ram->cursor_ring); SPICE_RING_INIT(&d->ram->release_ring); diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index ff855904ba..1fb7ad44ab 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -548,6 +548,7 @@ static int get_real_id(const char *devpath, const char *idname, uint16_t *val) if (fscanf(f, "%li\n", &id) == 1) { *val = id; } else { + fclose(f); return -1; } fclose(f); diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index d5944bca69..61a8aadddd 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -250,7 +250,7 @@ static int milkymist_memcard_init(SysBusDevice *dev) DriveInfo *dinfo; dinfo = drive_get_next(IF_SD); - s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0); + s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false); s->enabled = dinfo ? bdrv_is_inserted(dinfo->bdrv) : 0; memory_region_init_io(&s->regs_region, &memcard_mmio_ops, s, diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c index d4079cde0b..ba9f4b3098 100644 --- a/hw/sd/omap_mmc.c +++ b/hw/sd/omap_mmc.c @@ -592,7 +592,7 @@ struct omap_mmc_s *omap_mmc_init(hwaddr base, memory_region_add_subregion(sysmem, base, &s->iomem); /* Instantiate the storage */ - s->card = sd_init(bd, 0); + s->card = sd_init(bd, false); return s; } @@ -617,7 +617,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta, omap_l4_attach(ta, 0, &s->iomem); /* Instantiate the storage */ - s->card = sd_init(bd, 0); + s->card = sd_init(bd, false); s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0]; sd_set_cb(s->card, NULL, s->cdet); diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c index 2527296776..e08fd04e7e 100644 --- a/hw/sd/pl181.c +++ b/hw/sd/pl181.c @@ -485,7 +485,7 @@ static int pl181_init(SysBusDevice *dev) sysbus_init_irq(dev, &s->irq[1]); qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2); dinfo = drive_get_next(IF_SD); - s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0); + s->card = sd_init(dinfo ? dinfo->bdrv : NULL, false); return 0; } diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 2db1cabb7a..0574d6b26d 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -538,7 +538,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, memory_region_add_subregion(sysmem, base, &s->iomem); /* Instantiate the actual storage */ - s->card = sd_init(bd, 0); + s->card = sd_init(bd, false); register_savevm(NULL, "pxa2xx_mmci", 0, 0, pxa2xx_mmci_save, pxa2xx_mmci_load, s); diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 00650674bd..b9dd4bebc1 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1165,7 +1165,7 @@ static void sdhci_initfn(Object *obj) DriveInfo *di; di = drive_get_next(IF_SD); - s->card = sd_init(di ? di->bdrv : NULL, 0); + s->card = sd_init(di ? di->bdrv : NULL, false); s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0]; s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0]; sd_set_cb(s->card, s->ro_cb, s->eject_cb); diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index 4d3c4f6445..d47e2377f9 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -245,7 +245,7 @@ static int ssi_sd_init(SSISlave *dev) s->mode = SSI_SD_CMD; dinfo = drive_get_next(IF_SD); - s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, 1); + s->sd = sd_init(dinfo ? dinfo->bdrv : NULL, true); register_savevm(&dev->qdev, "ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s); return 0; } |