Commit 487414f1 authored by aliguori's avatar aliguori

hw: remove error handling from qemu_malloc() callers (Avi Kivity)

Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6529 c046a42c-6fe2-441c-8c8c-71466251a162
parent 090f1fa3
......@@ -331,13 +331,6 @@ int Adlib_init (AudioState *audio, qemu_irq *pic)
s->samples = AUD_get_buffer_size_out (s->voice) >> SHIFT;
s->mixbuf = qemu_mallocz (s->samples << SHIFT);
if (!s->mixbuf) {
dolog ("Could not allocate mixing buffer, %d samples (each %d bytes)\n",
s->samples, 1 << SHIFT);
Adlib_fini (s);
return -1;
}
register_ioport_read (0x388, 4, 1, adlib_read, s);
register_ioport_write (0x388, 4, 1, adlib_write, s);
......
......@@ -898,8 +898,6 @@ int apic_init(CPUState *env)
if (last_apic_id >= MAX_APICS)
return -1;
s = qemu_mallocz(sizeof(APICState));
if (!s)
return -1;
env->apic_state = s;
s->id = last_apic_id++;
env->cpuid_apic_id = s->id;
......@@ -1124,8 +1122,6 @@ IOAPICState *ioapic_init(void)
int io_memory;
s = qemu_mallocz(sizeof(IOAPICState));
if (!s)
return NULL;
ioapic_reset(s);
s->id = last_apic_id++;
......
......@@ -725,8 +725,6 @@ static gic_state *gic_init(uint32_t dist_base, qemu_irq *parent_irq)
int i;
s = (gic_state *)qemu_mallocz(sizeof(gic_state));
if (!s)
return NULL;
s->in = qemu_allocate_irqs(gic_set_irq, s, GIC_NIRQ);
for (i = 0; i < NCPU; i++) {
s->parent_irq[i] = parent_irq[i];
......
......@@ -194,8 +194,6 @@ void arm_sysctl_init(uint32_t base, uint32_t sys_id)
int iomemtype;
s = (arm_sysctl_state *)qemu_mallocz(sizeof(arm_sysctl_state));
if (!s)
return;
s->sys_id = sys_id;
/* The MPcore bootloader uses these flags to start secondary CPUs.
We don't use a bootloader, so do this here. */
......
......@@ -575,12 +575,7 @@ CharDriverState *chr_baum_init(void)
int tty;
baum = qemu_mallocz(sizeof(BaumDriverState));
if (!baum)
return NULL;
baum->chr = chr = qemu_mallocz(sizeof(CharDriverState));
if (!chr)
goto fail_baum;
chr->opaque = baum;
chr->chr_write = baum_write;
......@@ -588,8 +583,6 @@ CharDriverState *chr_baum_init(void)
chr->chr_accept_input = baum_accept_input;
handle = qemu_mallocz(brlapi_getHandleSize());
if (!handle)
goto fail_chr;
baum->brlapi = handle;
baum->brlapi_fd = brlapi__openConnection(handle, NULL, NULL);
......@@ -628,11 +621,8 @@ CharDriverState *chr_baum_init(void)
fail:
qemu_free_timer(baum->cellCount_timer);
brlapi__closeConnection(handle);
fail_handle:
free(handle);
fail_chr:
free(chr);
fail_baum:
free(baum);
return NULL;
}
......
......@@ -171,8 +171,6 @@ void cs_init(target_phys_addr_t base, int irq, void *intctl)
CSState *s;
s = qemu_mallocz(sizeof(CSState));
if (!s)
return;
cs_io_memory = cpu_register_io_memory(0, cs_mem_read, cs_mem_write, s);
cpu_register_physical_memory(base, CS_SIZE, cs_io_memory);
......
......@@ -647,11 +647,6 @@ int cs4231a_init (AudioState *audio, qemu_irq *pic)
}
s = qemu_mallocz (sizeof (*s));
if (!s) {
lerr ("Could not allocate memory for cs4231a (%zu bytes)\n",
sizeof (*s));
return -1;
}
s->pic = pic;
s->irq = conf.irq;
......
......@@ -152,13 +152,8 @@ void *ds1225y_init(target_phys_addr_t mem_base, const char *filename)
QEMUFile *file;
s = qemu_mallocz(sizeof(ds1225y_t));
if (!s)
return NULL;
s->chip_size = 0x2000; /* Fixed for ds1225y chip: 8 KiB */
s->contents = qemu_mallocz(s->chip_size);
if (!s->contents) {
return NULL;
}
s->protection = 7;
/* Read current file */
......
......@@ -320,8 +320,6 @@ void * ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version)
ECCState *s;
s = qemu_mallocz(sizeof(ECCState));
if (!s)
return NULL;
s->version = version;
s->regs[0] = version;
......
......@@ -727,8 +727,6 @@ int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
SerialState *s;
s = qemu_mallocz(sizeof(SerialState));
if (!s)
return 0;
escc_io_memory = cpu_register_io_memory(0, escc_mem_read,
escc_mem_write,
......@@ -909,8 +907,6 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
SerialState *s;
s = qemu_mallocz(sizeof(SerialState));
if (!s)
return;
s->it_shift = it_shift;
for (i = 0; i < 2; i++) {
......
......@@ -653,8 +653,6 @@ void *esp_init(target_phys_addr_t espaddr, int it_shift,
int esp_io_memory;
s = qemu_mallocz(sizeof(ESPState));
if (!s)
return NULL;
s->irq = irq;
s->it_shift = it_shift;
......
......@@ -756,22 +756,14 @@ void *etraxfs_dmac_init(CPUState *env,
struct fs_dma_ctrl *ctrl = NULL;
ctrl = qemu_mallocz(sizeof *ctrl);
if (!ctrl)
return NULL;
ctrl->bh = qemu_bh_new(DMA_run, ctrl);
ctrl->env = env;
ctrl->nr_channels = nr_channels;
ctrl->channels = qemu_mallocz(sizeof ctrl->channels[0] * nr_channels);
if (!ctrl->channels)
goto err;
ctrl->map = cpu_register_io_memory(0, dma_read, dma_write, ctrl);
cpu_register_physical_memory(base, nr_channels * 0x2000, ctrl->map);
return ctrl;
err:
qemu_free(ctrl->channels);
qemu_free(ctrl);
return NULL;
}
......@@ -564,12 +564,8 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env,
qemu_check_nic_model(nd, "fseth");
dma = qemu_mallocz(sizeof *dma * 2);
if (!dma)
return NULL;
eth = qemu_mallocz(sizeof *eth);
if (!eth)
goto err;
dma[0].client.push = eth_tx_push;
dma[0].client.opaque = eth;
......@@ -595,8 +591,4 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env,
eth->vc->link_status_changed = eth_set_link;
return dma;
err:
qemu_free(eth);
qemu_free(dma);
return NULL;
}
......@@ -192,8 +192,6 @@ struct etraxfs_pic *etraxfs_pic_init(CPUState *env, target_phys_addr_t base)
pic = qemu_mallocz(sizeof *pic);
pic->internal = fs = qemu_mallocz(sizeof *fs);
if (!fs || !pic)
goto err;
fs->env = env;
pic->irq = qemu_allocate_irqs(irq_handler, fs, 30);
......@@ -204,8 +202,4 @@ struct etraxfs_pic *etraxfs_pic_init(CPUState *env, target_phys_addr_t base)
cpu_register_physical_memory(base, 0x14, intr_vect_regs);
return pic;
err:
free(pic);
free(fs);
return NULL;
}
......@@ -233,8 +233,6 @@ void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr,
int ser_regs;
s = qemu_mallocz(sizeof *s);
if (!s)
return;
s->env = env;
s->irq = irq;
......
......@@ -321,8 +321,6 @@ void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, qemu_irq *nmi,
int timer_regs;
t = qemu_mallocz(sizeof *t);
if (!t)
return;
t->bh_t0 = qemu_bh_new(timer0_hit, t);
t->bh_t1 = qemu_bh_new(timer1_hit, t);
......
......@@ -1866,13 +1866,7 @@ static fdctrl_t *fdctrl_init_common (qemu_irq irq, int dma_chann,
FLOPPY_DPRINTF("init controller\n");
fdctrl = qemu_mallocz(sizeof(fdctrl_t));
if (!fdctrl)
return NULL;
fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN);
if (fdctrl->fifo == NULL) {
qemu_free(fdctrl);
return NULL;
}
fdctrl->result_timer = qemu_new_timer(vm_clock,
fdctrl_result_timer, fdctrl);
......
......@@ -619,26 +619,10 @@ static int OPLOpenTable( void )
double pom;
/* allocate dynamic tables */
if( (TL_TABLE = malloc(TL_MAX*2*sizeof(INT32))) == NULL)
return 0;
if( (SIN_TABLE = malloc(SIN_ENT*4 *sizeof(INT32 *))) == NULL)
{
free(TL_TABLE);
return 0;
}
if( (AMS_TABLE = malloc(AMS_ENT*2 *sizeof(INT32))) == NULL)
{
free(TL_TABLE);
free(SIN_TABLE);
return 0;
}
if( (VIB_TABLE = malloc(VIB_ENT*2 *sizeof(INT32))) == NULL)
{
free(TL_TABLE);
free(SIN_TABLE);
free(AMS_TABLE);
return 0;
}
TL_TABLE = qemu_malloc(TL_MAX*2*sizeof(INT32));
SIN_TABLE = qemu_malloc(SIN_ENT*4 *sizeof(INT32 *));
AMS_TABLE = qemu_malloc(AMS_ENT*2 *sizeof(INT32));
VIB_TABLE = qemu_malloc(VIB_ENT*2 *sizeof(INT32));
/* make total level table */
for (t = 0;t < EG_ENT-1 ;t++){
rate = ((1<<TL_BITS)-1)/pow(10,EG_STEP*t/20); /* dB -> voltage */
......@@ -1221,8 +1205,7 @@ FM_OPL *OPLCreate(int type, int clock, int rate)
if(type&OPL_TYPE_ADPCM) state_size+= sizeof(YM_DELTAT);
#endif
/* allocate memory block */
ptr = malloc(state_size);
if(ptr==NULL) return NULL;
ptr = qemu_malloc(state_size);
/* clear */
memset(ptr,0,state_size);
OPL = (FM_OPL *)ptr; ptr+=sizeof(FM_OPL);
......
......@@ -206,8 +206,6 @@ int fw_cfg_add_i16(void *opaque, uint16_t key, uint16_t value)
uint16_t *copy;
copy = qemu_malloc(sizeof(value));
if (!copy)
return 0;
*copy = cpu_to_le16(value);
return fw_cfg_add_bytes(opaque, key, (uint8_t *)copy, sizeof(value));
}
......@@ -217,8 +215,6 @@ int fw_cfg_add_i32(void *opaque, uint16_t key, uint32_t value)
uint32_t *copy;
copy = qemu_malloc(sizeof(value));
if (!copy)
return 0;
*copy = cpu_to_le32(value);
return fw_cfg_add_bytes(opaque, key, (uint8_t *)copy, sizeof(value));
}
......@@ -228,8 +224,6 @@ int fw_cfg_add_i64(void *opaque, uint16_t key, uint64_t value)
uint64_t *copy;
copy = qemu_malloc(sizeof(value));
if (!copy)
return 0;
*copy = cpu_to_le64(value);
return fw_cfg_add_bytes(opaque, key, (uint8_t *)copy, sizeof(value));
}
......@@ -263,8 +257,6 @@ void *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
int io_ctl_memory, io_data_memory;
s = qemu_mallocz(sizeof(FWCfgState));
if (!s)
return NULL;
if (ctl_port) {
register_ioport_write(ctl_port, 2, 2, fw_cfg_io_writew, s);
......
......@@ -593,8 +593,6 @@ int g364fb_mm_init(uint8_t *vram, ram_addr_t vram_offset,
int io_ctrl;
s = qemu_mallocz(sizeof(G364State));
if (!s)
return -1;
s->vram = vram;
s->vram_offset = vram_offset;
......
......@@ -261,11 +261,6 @@ int GUS_init (AudioState *audio, qemu_irq *pic)
}
s = qemu_mallocz (sizeof (*s));
if (!s) {
dolog ("Could not allocate memory for GUS (%zu bytes)\n",
sizeof (*s));
return -1;
}
AUD_register_card (audio, "gus", &s->card);
......@@ -292,12 +287,6 @@ int GUS_init (AudioState *audio, qemu_irq *pic)
s->shift = 2;
s->samples = AUD_get_buffer_size_out (s->voice) >> s->shift;
s->mixbuf = qemu_mallocz (s->samples << s->shift);
if (!s->mixbuf) {
AUD_close_out (&s->card, s->voice);
AUD_remove_card (&s->card);
qemu_free (s);
return -1;
}
register_ioport_write (conf.port, 1, 1, gus_writeb, s);
register_ioport_write (conf.port, 1, 2, gus_writew, s);
......
......@@ -550,8 +550,6 @@ qemu_irq *i8259_init(qemu_irq parent_irq)
PicState2 *s;
s = qemu_mallocz(sizeof(PicState2));
if (!s)
return NULL;
pic_init1(0x20, 0x4d0, &s->pics[0]);
pic_init1(0xa0, 0x4d1, &s->pics[1]);
s->pics[0].elcr_mask = 0xf8;
......
......@@ -2895,8 +2895,6 @@ void isa_ide_init(int iobase, int iobase2, qemu_irq irq,
IDEState *ide_state;
ide_state = qemu_mallocz(sizeof(IDEState) * 2);
if (!ide_state)
return;
ide_init2(ide_state, hd0, hd1, irq);
ide_init_ioport(ide_state, iobase, iobase2);
......
......@@ -378,8 +378,6 @@ static qemu_irq *icp_pic_init(uint32_t base,
qemu_irq *qi;
s = (icp_pic_state *)qemu_mallocz(sizeof(icp_pic_state));
if (!s)
return NULL;
qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32);
s->parent_irq = parent_irq;
s->parent_fiq = parent_fiq;
......
......@@ -371,8 +371,6 @@ void *iommu_init(target_phys_addr_t addr, uint32_t version, qemu_irq irq)
int iommu_io_memory;
s = qemu_mallocz(sizeof(IOMMUState));
if (!s)
return NULL;
s->version = version;
s->irq = irq;
......
......@@ -304,8 +304,6 @@ void jazz_led_init(target_phys_addr_t base)
int io;
s = qemu_mallocz(sizeof(LedState));
if (!s)
return;
s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND;
......
......@@ -622,13 +622,7 @@ m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base,
target_phys_addr_t save_base;
s = qemu_mallocz(sizeof(m48t59_t));
if (!s)
return NULL;
s->buffer = qemu_mallocz(size);
if (!s->buffer) {
qemu_free(s);
return NULL;
}
s->IRQ = IRQ;
s->size = size;
s->io_base = io_base;
......
......@@ -865,8 +865,6 @@ void* DBDMA_init (int *dbdma_mem_index)
DBDMA_channel *s;
s = qemu_mallocz(sizeof(DBDMA_channel) * DBDMA_CHANNELS);
if (!s)
return NULL;
*dbdma_mem_index = cpu_register_io_memory(0, dbdma_read, dbdma_write, s);
register_savevm("dbdma", -1, 1, dbdma_save, dbdma_load, s);
......
......@@ -132,13 +132,7 @@ MacIONVRAMState *macio_nvram_init (int *mem_index, target_phys_addr_t size)
MacIONVRAMState *s;
s = qemu_mallocz(sizeof(MacIONVRAMState));
if (!s)
return NULL;
s->data = qemu_mallocz(size);
if (!s->data) {
qemu_free(s);
return NULL;
}
s->size = size;
s->mem_index = cpu_register_io_memory(0, nvram_read, nvram_write, s);
......
......@@ -532,8 +532,6 @@ RTCState *rtc_init(int base, qemu_irq irq, int base_year)
RTCState *s;
s = qemu_mallocz(sizeof(RTCState));
if (!s)
return NULL;
s->irq = irq;
s->cmos_data[RTC_REG_A] = 0x26;
......@@ -644,8 +642,6 @@ RTCState *rtc_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq,
int io_memory;
s = qemu_mallocz(sizeof(RTCState));
if (!s)
return NULL;
s->irq = irq;
s->cmos_data[RTC_REG_A] = 0x26;
......
......@@ -239,8 +239,6 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd)
qemu_check_nic_model(nd, "mipsnet");
s = qemu_mallocz(sizeof(MIPSnetState));
if (!s)
return;
register_ioport_write(base, 36, 1, mipsnet_ioport_write, s);
register_ioport_read(base, 36, 1, mipsnet_ioport_read, s);
......
......@@ -265,8 +265,6 @@ static qemu_irq *mpcore_priv_init(uint32_t base, qemu_irq *pic_irq)
int i;
s = (mpcore_priv_state *)qemu_mallocz(sizeof(mpcore_priv_state));
if (!s)
return NULL;
s->gic = gic_init(base + 0x1000, pic_irq);
if (!s->gic)
return NULL;
......
......@@ -225,8 +225,6 @@ qemu_irq *mst_irq_init(struct pxa2xx_state_s *cpu, uint32_t base, int irq)
s = (mst_irq_state *)
qemu_mallocz(sizeof(mst_irq_state));
if (!s)
return NULL;
s->parent = &cpu->pic[irq];
/* alloc the external 16 irqs */
......
......@@ -443,13 +443,9 @@ static i2c_interface *musicpal_audio_init(uint32_t base, qemu_irq irq)
}
s = qemu_mallocz(sizeof(musicpal_audio_state));
if (!s)
return NULL;
s->irq = irq;
i2c = qemu_mallocz(sizeof(i2c_interface));
if (!i2c)
return NULL;
i2c->bus = i2c_init_bus();
i2c->current_addr = -1;
......@@ -717,8 +713,6 @@ static void mv88w8618_eth_init(NICInfo *nd, uint32_t base, qemu_irq irq)
qemu_check_nic_model(nd, "mv88w8618");
s = qemu_mallocz(sizeof(mv88w8618_eth_state));
if (!s)
return;
s->irq = irq;
s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
eth_receive, eth_can_receive, s);
......@@ -911,8 +905,6 @@ static void musicpal_lcd_init(uint32_t base)
int iomemtype;
s = qemu_mallocz(sizeof(musicpal_lcd_state));
if (!s)
return;
iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn,
musicpal_lcd_writefn, s);
cpu_register_physical_memory(base, MP_LCD_SIZE, iomemtype);
......@@ -1008,8 +1000,6 @@ static qemu_irq *mv88w8618_pic_init(uint32_t base, qemu_irq parent_irq)
qemu_irq *qi;
s = qemu_mallocz(sizeof(mv88w8618_pic_state));
if (!s)
return NULL;
qi = qemu_allocate_irqs(mv88w8618_pic_set_irq, s, 32);
s->parent_irq = parent_irq;
iomemtype = cpu_register_io_memory(0, mv88w8618_pic_readfn,
......@@ -1134,8 +1124,6 @@ static void mv88w8618_pit_init(uint32_t base, qemu_irq *pic, int irq)
mv88w8618_pit_state *s;
s = qemu_mallocz(sizeof(mv88w8618_pit_state));
if (!s)
return;
/* Letting them all run at 1 MHz is likely just a pragmatic
* simplification. */
......@@ -1200,8 +1188,6 @@ static void mv88w8618_flashcfg_init(uint32_t base)
mv88w8618_flashcfg_state *s;
s = qemu_mallocz(sizeof(mv88w8618_flashcfg_state));
if (!s)
return;
s->cfgr0 = 0xfffe4285; /* Default as set by U-Boot for 8 MB flash */
iomemtype = cpu_register_io_memory(0, mv88w8618_flashcfg_readfn,
......
......@@ -725,8 +725,6 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd)
qemu_check_nic_model(nd, "ne2k_isa");
s = qemu_mallocz(sizeof(NE2000State));
if (!s)
return;
register_ioport_write(base, 16, 1, ne2000_ioport_write, s);
register_ioport_read(base, 16, 1, ne2000_ioport_read, s);
......
......@@ -445,8 +445,6 @@ ParallelState *parallel_init(int base, qemu_irq irq, CharDriverState *chr)
uint8_t dummy;
s = qemu_mallocz(sizeof(ParallelState));
if (!s)
return NULL;
s->irq = irq;
s->chr = chr;
parallel_reset(s);
......@@ -539,8 +537,6 @@ ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq
int io_sw;
s = qemu_mallocz(sizeof(ParallelState));
if (!s)
return NULL;
s->irq = irq;
s->chr = chr;
s->it_shift = it_shift;
......
......@@ -178,8 +178,6 @@ PCIDevice *pci_register_device(PCIBus *bus, const char *name,
found: ;
}
pci_dev = qemu_mallocz(instance_size);
if (!pci_dev)
return NULL;
pci_dev->bus = bus;
pci_dev->devfn = devfn;
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
......
......@@ -2089,8 +2089,6 @@ void lance_init(NICInfo *nd, target_phys_addr_t leaddr, void *dma_opaque,
qemu_check_nic_model(nd, "lance");
d = qemu_mallocz(sizeof(PCNetState));
if (!d)
return;
lance_io_memory =
cpu_register_io_memory(0, lance_mem_read, lance_mem_write, d);
......
......@@ -519,8 +519,6 @@ pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off,
pfl = qemu_mallocz(sizeof(pflash_t));
if (pfl == NULL)
return NULL;
pfl->storage = phys_ram_base + off;
pfl->fl_mem = cpu_register_io_memory(0,
pflash_read_ops, pflash_write_ops, pfl);
......
......@@ -557,8 +557,6 @@ pflash_t *pflash_cfi02_register(target_phys_addr_t base, ram_addr_t off,
return NULL;
#endif
pfl = qemu_mallocz(sizeof(pflash_t));
if (pfl == NULL)
return NULL;
pfl->storage = phys_ram_base + off;
pfl->fl_mem = cpu_register_io_memory(0, pflash_read_ops, pflash_write_ops,
pfl);
......
......@@ -193,8 +193,6 @@ void pl031_init(uint32_t base, qemu_irq irq)
struct tm tm;
s = qemu_mallocz(sizeof(pl031_state));
if (!s)
cpu_abort(cpu_single_env, "pl031_init: Out of memory\n");
iomemtype = cpu_register_io_memory(0, pl031_readfn, pl031_writefn, s);
if (iomemtype == -1)
......
......@@ -645,8 +645,6 @@ clk_setup_cb cpu_ppc_tb_init (CPUState *env, uint32_t freq)
ppc_tb_t *tb_env;
tb_env = qemu_mallocz(sizeof(ppc_tb_t));
if (tb_env == NULL)
return NULL;
env->tb_env = tb_env;
/* Create new timer */
tb_env->decr_timer = qemu_new_timer(vm_clock, &cpu_ppc_decr_cb, env);
......@@ -915,9 +913,6 @@ clk_setup_cb ppc_emb_timers_init (CPUState *env, uint32_t freq)
ppcemb_timer_t *ppcemb_timer;
tb_env = qemu_mallocz(sizeof(ppc_tb_t));
if (tb_env == NULL) {
return NULL;
}
env->tb_env = tb_env;
ppcemb_timer = qemu_mallocz(sizeof(ppcemb_timer_t));
tb_env->tb_freq = freq;
......@@ -1024,8 +1019,6 @@ int ppc_dcr_init (CPUState *env, int (*read_error)(int dcrn),
ppc_dcr_t *dcr_env;
dcr_env = qemu_mallocz(sizeof(ppc_dcr_t));
if (dcr_env == NULL)
return -1;
dcr_env->read_error = read_error;
dcr_env->write_error = write_error;
env->dcr_env = dcr_env;
......
......@@ -162,13 +162,11 @@ static void ref405ep_fpga_init (uint32_t base)
int fpga_memory;
fpga = qemu_mallocz(sizeof(ref405ep_fpga_t));
if (fpga != NULL) {
fpga_memory = cpu_register_io_memory(0, ref405ep_fpga_read,
ref405ep_fpga_write, fpga);
cpu_register_physical_memory(base, 0x00000100, fpga_memory);
ref405ep_fpga_reset(fpga);
qemu_register_reset(&ref405ep_fpga_reset, fpga);
}
fpga_memory = cpu_register_io_memory(0, ref405ep_fpga_read,
ref405ep_fpga_write, fpga);
cpu_register_physical_memory(base, 0x00000100, fpga_memory);
ref405ep_fpga_reset(fpga);
qemu_register_reset(&ref405ep_fpga_reset, fpga);
}
static void ref405ep_init (ram_addr_t ram_size, int vga_ram_size,
......@@ -486,13 +484,11 @@ static void taihu_cpld_init (uint32_t base)
int cpld_memory;
cpld = qemu_mallocz(sizeof(taihu_cpld_t));
if (cpld != NULL) {
cpld_memory = cpu_register_io_memory(0, taihu_cpld_read,
taihu_cpld_write, cpld);
cpu_register_physical_memory(base, 0x00000100, cpld_memory);
taihu_cpld_reset(cpld);
qemu_register_reset(&taihu_cpld_reset, cpld);
}
cpld_memory = cpu_register_io_memory(0, taihu_cpld_read,
taihu_cpld_write, cpld);
cpu_register_physical_memory(base, 0x00000100, cpld_memory);
taihu_cpld_reset(cpld);
qemu_register_reset(&taihu_cpld_reset, cpld);
}
static void taihu_405ep_init(ram_addr_t ram_size, int vga_ram_size,
......
This diff is collapsed.
......@@ -42,8 +42,6 @@ static void *bamboo_load_device_tree(void *addr,
pathlen = snprintf(NULL, 0, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE) + 1;
path = qemu_malloc(pathlen);
if (path == NULL)
return NULL;
snprintf(path, pathlen, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE);
......
......@@ -246,18 +246,16 @@ ppc4xx_mmio_t *ppc4xx_mmio_init (CPUState *env, target_phys_addr_t base)
int mmio_memory;
mmio = qemu_mallocz(sizeof(ppc4xx_mmio_t));
if (mmio != NULL) {