From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVCMM-0005ve-UY for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:06:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVCMK-0005uf-Rm for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:06:10 -0500 Received: from [199.232.76.173] (port=44918 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVCMK-0005ub-Mz for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:06:08 -0500 Received: from savannah.gnu.org ([199.232.41.3]:35497 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LVCMJ-0002S6-GC for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:06:08 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LVCMI-0007hT-C9 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 22:06:06 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LVCMH-0007hP-Og for qemu-devel@nongnu.org; Thu, 05 Feb 2009 22:06:06 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 05 Feb 2009 22:06:05 +0000 Subject: [Qemu-devel] [6529] hw: remove error handling from qemu_malloc() callers (Avi Kivity) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6529 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6529 Author: aliguori Date: 2009-02-05 22:06:05 +0000 (Thu, 05 Feb 2009) Log Message: ----------- hw: remove error handling from qemu_malloc() callers (Avi Kivity) Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/hw/adlib.c trunk/hw/apic.c trunk/hw/arm_gic.c trunk/hw/arm_sysctl.c trunk/hw/baum.c trunk/hw/cs4231.c trunk/hw/cs4231a.c trunk/hw/ds1225y.c trunk/hw/eccmemctl.c trunk/hw/escc.c trunk/hw/esp.c trunk/hw/etraxfs_dma.c trunk/hw/etraxfs_eth.c trunk/hw/etraxfs_pic.c trunk/hw/etraxfs_ser.c trunk/hw/etraxfs_timer.c trunk/hw/fdc.c trunk/hw/fmopl.c trunk/hw/fw_cfg.c trunk/hw/g364fb.c trunk/hw/gus.c trunk/hw/i8259.c trunk/hw/ide.c trunk/hw/integratorcp.c trunk/hw/iommu.c trunk/hw/jazz_led.c trunk/hw/m48t59.c trunk/hw/mac_dbdma.c trunk/hw/mac_nvram.c trunk/hw/mc146818rtc.c trunk/hw/mipsnet.c trunk/hw/mpcore.c trunk/hw/mst_fpga.c trunk/hw/musicpal.c trunk/hw/ne2000.c trunk/hw/parallel.c trunk/hw/pci.c trunk/hw/pcnet.c trunk/hw/pflash_cfi01.c trunk/hw/pflash_cfi02.c trunk/hw/pl031.c trunk/hw/ppc.c trunk/hw/ppc405_boards.c trunk/hw/ppc405_uc.c trunk/hw/ppc440_bamboo.c trunk/hw/ppc4xx_devs.c trunk/hw/ppc4xx_pci.c trunk/hw/ppc_prep.c trunk/hw/r2d.c trunk/hw/rc4030.c trunk/hw/sb16.c trunk/hw/sbi.c trunk/hw/serial.c trunk/hw/sh_intc.c trunk/hw/sh_serial.c trunk/hw/slavio_intctl.c trunk/hw/slavio_misc.c trunk/hw/slavio_timer.c trunk/hw/sparc32_dma.c trunk/hw/sun4c_intctl.c trunk/hw/tcx.c trunk/hw/usb-bt.c trunk/hw/usb-hid.c trunk/hw/usb-hub.c trunk/hw/usb-msd.c trunk/hw/usb-net.c trunk/hw/usb-serial.c trunk/hw/usb-uhci.c trunk/hw/usb-wacom.c trunk/hw/versatilepb.c trunk/hw/vga.c trunk/hw/virtio-blk.c trunk/hw/virtio.c trunk/hw/vmmouse.c Modified: trunk/hw/adlib.c =================================================================== --- trunk/hw/adlib.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/adlib.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -331,13 +331,6 @@ 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); Modified: trunk/hw/apic.c =================================================================== --- trunk/hw/apic.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/apic.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -898,8 +898,6 @@ 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 @@ int io_memory; s = qemu_mallocz(sizeof(IOAPICState)); - if (!s) - return NULL; ioapic_reset(s); s->id = last_apic_id++; Modified: trunk/hw/arm_gic.c =================================================================== --- trunk/hw/arm_gic.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/arm_gic.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -725,8 +725,6 @@ 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]; Modified: trunk/hw/arm_sysctl.c =================================================================== --- trunk/hw/arm_sysctl.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/arm_sysctl.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -194,8 +194,6 @@ 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. */ Modified: trunk/hw/baum.c =================================================================== --- trunk/hw/baum.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/baum.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -575,12 +575,7 @@ 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 @@ 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 @@ fail: qemu_free_timer(baum->cellCount_timer); brlapi__closeConnection(handle); -fail_handle: free(handle); -fail_chr: free(chr); -fail_baum: free(baum); return NULL; } Modified: trunk/hw/cs4231.c =================================================================== --- trunk/hw/cs4231.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/cs4231.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -171,8 +171,6 @@ 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); Modified: trunk/hw/cs4231a.c =================================================================== --- trunk/hw/cs4231a.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/cs4231a.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -647,11 +647,6 @@ } 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; Modified: trunk/hw/ds1225y.c =================================================================== --- trunk/hw/ds1225y.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ds1225y.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -152,13 +152,8 @@ 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 */ Modified: trunk/hw/eccmemctl.c =================================================================== --- trunk/hw/eccmemctl.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/eccmemctl.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -320,8 +320,6 @@ ECCState *s; s = qemu_mallocz(sizeof(ECCState)); - if (!s) - return NULL; s->version = version; s->regs[0] = version; Modified: trunk/hw/escc.c =================================================================== --- trunk/hw/escc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/escc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -727,8 +727,6 @@ 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 @@ SerialState *s; s = qemu_mallocz(sizeof(SerialState)); - if (!s) - return; s->it_shift = it_shift; for (i = 0; i < 2; i++) { Modified: trunk/hw/esp.c =================================================================== --- trunk/hw/esp.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/esp.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -653,8 +653,6 @@ int esp_io_memory; s = qemu_mallocz(sizeof(ESPState)); - if (!s) - return NULL; s->irq = irq; s->it_shift = it_shift; Modified: trunk/hw/etraxfs_dma.c =================================================================== --- trunk/hw/etraxfs_dma.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/etraxfs_dma.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -756,22 +756,14 @@ 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; } Modified: trunk/hw/etraxfs_eth.c =================================================================== --- trunk/hw/etraxfs_eth.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/etraxfs_eth.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -564,12 +564,8 @@ 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 @@ eth->vc->link_status_changed = eth_set_link; return dma; - err: - qemu_free(eth); - qemu_free(dma); - return NULL; } Modified: trunk/hw/etraxfs_pic.c =================================================================== --- trunk/hw/etraxfs_pic.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/etraxfs_pic.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -192,8 +192,6 @@ 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 @@ cpu_register_physical_memory(base, 0x14, intr_vect_regs); return pic; - err: - free(pic); - free(fs); - return NULL; } Modified: trunk/hw/etraxfs_ser.c =================================================================== --- trunk/hw/etraxfs_ser.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/etraxfs_ser.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -233,8 +233,6 @@ int ser_regs; s = qemu_mallocz(sizeof *s); - if (!s) - return; s->env = env; s->irq = irq; Modified: trunk/hw/etraxfs_timer.c =================================================================== --- trunk/hw/etraxfs_timer.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/etraxfs_timer.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -321,8 +321,6 @@ 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); Modified: trunk/hw/fdc.c =================================================================== --- trunk/hw/fdc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/fdc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -1866,13 +1866,7 @@ 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); Modified: trunk/hw/fmopl.c =================================================================== --- trunk/hw/fmopl.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/fmopl.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -619,26 +619,10 @@ 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< voltage */ @@ -1221,8 +1205,7 @@ 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); Modified: trunk/hw/fw_cfg.c =================================================================== --- trunk/hw/fw_cfg.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/fw_cfg.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -206,8 +206,6 @@ 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 @@ 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 @@ 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 @@ 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); Modified: trunk/hw/g364fb.c =================================================================== --- trunk/hw/g364fb.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/g364fb.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -593,8 +593,6 @@ int io_ctrl; s = qemu_mallocz(sizeof(G364State)); - if (!s) - return -1; s->vram = vram; s->vram_offset = vram_offset; Modified: trunk/hw/gus.c =================================================================== --- trunk/hw/gus.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/gus.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -261,11 +261,6 @@ } 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 @@ 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); Modified: trunk/hw/i8259.c =================================================================== --- trunk/hw/i8259.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/i8259.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -550,8 +550,6 @@ 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; Modified: trunk/hw/ide.c =================================================================== --- trunk/hw/ide.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ide.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -2895,8 +2895,6 @@ 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); Modified: trunk/hw/integratorcp.c =================================================================== --- trunk/hw/integratorcp.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/integratorcp.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -378,8 +378,6 @@ 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; Modified: trunk/hw/iommu.c =================================================================== --- trunk/hw/iommu.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/iommu.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -371,8 +371,6 @@ int iommu_io_memory; s = qemu_mallocz(sizeof(IOMMUState)); - if (!s) - return NULL; s->version = version; s->irq = irq; Modified: trunk/hw/jazz_led.c =================================================================== --- trunk/hw/jazz_led.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/jazz_led.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -304,8 +304,6 @@ int io; s = qemu_mallocz(sizeof(LedState)); - if (!s) - return; s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND; Modified: trunk/hw/m48t59.c =================================================================== --- trunk/hw/m48t59.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/m48t59.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -622,13 +622,7 @@ 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; Modified: trunk/hw/mac_dbdma.c =================================================================== --- trunk/hw/mac_dbdma.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/mac_dbdma.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -865,8 +865,6 @@ 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); Modified: trunk/hw/mac_nvram.c =================================================================== --- trunk/hw/mac_nvram.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/mac_nvram.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -132,13 +132,7 @@ 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); Modified: trunk/hw/mc146818rtc.c =================================================================== --- trunk/hw/mc146818rtc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/mc146818rtc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -532,8 +532,6 @@ 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 @@ int io_memory; s = qemu_mallocz(sizeof(RTCState)); - if (!s) - return NULL; s->irq = irq; s->cmos_data[RTC_REG_A] = 0x26; Modified: trunk/hw/mipsnet.c =================================================================== --- trunk/hw/mipsnet.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/mipsnet.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -239,8 +239,6 @@ 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); Modified: trunk/hw/mpcore.c =================================================================== --- trunk/hw/mpcore.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/mpcore.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -265,8 +265,6 @@ 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; Modified: trunk/hw/mst_fpga.c =================================================================== --- trunk/hw/mst_fpga.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/mst_fpga.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -225,8 +225,6 @@ s = (mst_irq_state *) qemu_mallocz(sizeof(mst_irq_state)); - if (!s) - return NULL; s->parent = &cpu->pic[irq]; /* alloc the external 16 irqs */ Modified: trunk/hw/musicpal.c =================================================================== --- trunk/hw/musicpal.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/musicpal.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -443,13 +443,9 @@ } 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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, Modified: trunk/hw/ne2000.c =================================================================== --- trunk/hw/ne2000.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ne2000.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -725,8 +725,6 @@ 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); Modified: trunk/hw/parallel.c =================================================================== --- trunk/hw/parallel.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/parallel.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -445,8 +445,6 @@ 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 @@ int io_sw; s = qemu_mallocz(sizeof(ParallelState)); - if (!s) - return NULL; s->irq = irq; s->chr = chr; s->it_shift = it_shift; Modified: trunk/hw/pci.c =================================================================== --- trunk/hw/pci.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/pci.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -178,8 +178,6 @@ 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); Modified: trunk/hw/pcnet.c =================================================================== --- trunk/hw/pcnet.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/pcnet.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -2089,8 +2089,6 @@ 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); Modified: trunk/hw/pflash_cfi01.c =================================================================== --- trunk/hw/pflash_cfi01.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/pflash_cfi01.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -519,8 +519,6 @@ 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); Modified: trunk/hw/pflash_cfi02.c =================================================================== --- trunk/hw/pflash_cfi02.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/pflash_cfi02.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -557,8 +557,6 @@ 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); Modified: trunk/hw/pl031.c =================================================================== --- trunk/hw/pl031.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/pl031.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -193,8 +193,6 @@ 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) Modified: trunk/hw/ppc.c =================================================================== --- trunk/hw/ppc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -645,8 +645,6 @@ 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 @@ 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 @@ 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; Modified: trunk/hw/ppc405_boards.c =================================================================== --- trunk/hw/ppc405_boards.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc405_boards.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -162,13 +162,11 @@ 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 @@ 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, Modified: trunk/hw/ppc405_uc.c =================================================================== --- trunk/hw/ppc405_uc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc405_uc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -169,13 +169,11 @@ ppc4xx_plb_t *plb; plb = qemu_mallocz(sizeof(ppc4xx_plb_t)); - if (plb != NULL) { - ppc_dcr_register(env, PLB0_ACR, plb, &dcr_read_plb, &dcr_write_plb); - ppc_dcr_register(env, PLB0_BEAR, plb, &dcr_read_plb, &dcr_write_plb); - ppc_dcr_register(env, PLB0_BESR, plb, &dcr_read_plb, &dcr_write_plb); - ppc4xx_plb_reset(plb); - qemu_register_reset(ppc4xx_plb_reset, plb); - } + ppc_dcr_register(env, PLB0_ACR, plb, &dcr_read_plb, &dcr_write_plb); + ppc_dcr_register(env, PLB0_BEAR, plb, &dcr_read_plb, &dcr_write_plb); + ppc_dcr_register(env, PLB0_BESR, plb, &dcr_read_plb, &dcr_write_plb); + ppc4xx_plb_reset(plb); + qemu_register_reset(ppc4xx_plb_reset, plb); } /*****************************************************************************/ @@ -248,13 +246,11 @@ ppc4xx_pob_t *pob; pob = qemu_mallocz(sizeof(ppc4xx_pob_t)); - if (pob != NULL) { - ppc_dcr_register(env, POB0_BEAR, pob, &dcr_read_pob, &dcr_write_pob); - ppc_dcr_register(env, POB0_BESR0, pob, &dcr_read_pob, &dcr_write_pob); - ppc_dcr_register(env, POB0_BESR1, pob, &dcr_read_pob, &dcr_write_pob); - qemu_register_reset(ppc4xx_pob_reset, pob); - ppc4xx_pob_reset(env); - } + ppc_dcr_register(env, POB0_BEAR, pob, &dcr_read_pob, &dcr_write_pob); + ppc_dcr_register(env, POB0_BESR0, pob, &dcr_read_pob, &dcr_write_pob); + ppc_dcr_register(env, POB0_BESR1, pob, &dcr_read_pob, &dcr_write_pob); + qemu_register_reset(ppc4xx_pob_reset, pob); + ppc4xx_pob_reset(env); } /*****************************************************************************/ @@ -384,16 +380,14 @@ ppc4xx_opba_t *opba; opba = qemu_mallocz(sizeof(ppc4xx_opba_t)); - if (opba != NULL) { - opba->base = offset; + opba->base = offset; #ifdef DEBUG_OPBA - printf("%s: offset " PADDRX "\n", __func__, offset); + printf("%s: offset " PADDRX "\n", __func__, offset); #endif - ppc4xx_mmio_register(env, mmio, offset, 0x002, - opba_read, opba_write, opba); - qemu_register_reset(ppc4xx_opba_reset, opba); - ppc4xx_opba_reset(opba); - } + ppc4xx_mmio_register(env, mmio, offset, 0x002, + opba_read, opba_write, opba); + qemu_register_reset(ppc4xx_opba_reset, opba); + ppc4xx_opba_reset(opba); } /*****************************************************************************/ @@ -585,14 +579,12 @@ ppc4xx_ebc_t *ebc; ebc = qemu_mallocz(sizeof(ppc4xx_ebc_t)); - if (ebc != NULL) { - ebc_reset(ebc); - qemu_register_reset(&ebc_reset, ebc); - ppc_dcr_register(env, EBC0_CFGADDR, - ebc, &dcr_read_ebc, &dcr_write_ebc); - ppc_dcr_register(env, EBC0_CFGDATA, - ebc, &dcr_read_ebc, &dcr_write_ebc); - } + ebc_reset(ebc); + qemu_register_reset(&ebc_reset, ebc); + ppc_dcr_register(env, EBC0_CFGADDR, + ebc, &dcr_read_ebc, &dcr_write_ebc); + ppc_dcr_register(env, EBC0_CFGDATA, + ebc, &dcr_read_ebc, &dcr_write_ebc); } /*****************************************************************************/ @@ -678,59 +670,57 @@ ppc405_dma_t *dma; dma = qemu_mallocz(sizeof(ppc405_dma_t)); - if (dma != NULL) { - memcpy(dma->irqs, irqs, 4 * sizeof(qemu_irq)); - ppc405_dma_reset(dma); - qemu_register_reset(&ppc405_dma_reset, dma); - ppc_dcr_register(env, DMA0_CR0, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CT0, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_DA0, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SA0, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SG0, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CR1, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CT1, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_DA1, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SA1, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SG1, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CR2, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CT2, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_DA2, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SA2, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SG2, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CR3, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_CT3, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_DA3, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SA3, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SG3, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SR, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SGC, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_SLP, - dma, &dcr_read_dma, &dcr_write_dma); - ppc_dcr_register(env, DMA0_POL, - dma, &dcr_read_dma, &dcr_write_dma); - } + memcpy(dma->irqs, irqs, 4 * sizeof(qemu_irq)); + ppc405_dma_reset(dma); + qemu_register_reset(&ppc405_dma_reset, dma); + ppc_dcr_register(env, DMA0_CR0, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CT0, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_DA0, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SA0, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SG0, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CR1, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CT1, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_DA1, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SA1, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SG1, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CR2, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CT2, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_DA2, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SA2, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SG2, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CR3, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_CT3, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_DA3, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SA3, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SG3, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SR, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SGC, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_SLP, + dma, &dcr_read_dma, &dcr_write_dma); + ppc_dcr_register(env, DMA0_POL, + dma, &dcr_read_dma, &dcr_write_dma); } /*****************************************************************************/ @@ -845,16 +835,14 @@ ppc405_gpio_t *gpio; gpio = qemu_mallocz(sizeof(ppc405_gpio_t)); - if (gpio != NULL) { - gpio->base = offset; - ppc405_gpio_reset(gpio); - qemu_register_reset(&ppc405_gpio_reset, gpio); + gpio->base = offset; + ppc405_gpio_reset(gpio); + qemu_register_reset(&ppc405_gpio_reset, gpio); #ifdef DEBUG_GPIO - printf("%s: offset " PADDRX "\n", __func__, offset); + printf("%s: offset " PADDRX "\n", __func__, offset); #endif - ppc4xx_mmio_register(env, mmio, offset, 0x038, - ppc405_gpio_read, ppc405_gpio_write, gpio); - } + ppc4xx_mmio_register(env, mmio, offset, 0x038, + ppc405_gpio_read, ppc405_gpio_write, gpio); } /*****************************************************************************/ @@ -1038,19 +1026,17 @@ ppc405_ocm_t *ocm; ocm = qemu_mallocz(sizeof(ppc405_ocm_t)); - if (ocm != NULL) { - ocm->offset = offset; - ocm_reset(ocm); - qemu_register_reset(&ocm_reset, ocm); - ppc_dcr_register(env, OCM0_ISARC, - ocm, &dcr_read_ocm, &dcr_write_ocm); - ppc_dcr_register(env, OCM0_ISACNTL, - ocm, &dcr_read_ocm, &dcr_write_ocm); - ppc_dcr_register(env, OCM0_DSARC, - ocm, &dcr_read_ocm, &dcr_write_ocm); - ppc_dcr_register(env, OCM0_DSACNTL, - ocm, &dcr_read_ocm, &dcr_write_ocm); - } + ocm->offset = offset; + ocm_reset(ocm); + qemu_register_reset(&ocm_reset, ocm); + ppc_dcr_register(env, OCM0_ISARC, + ocm, &dcr_read_ocm, &dcr_write_ocm); + ppc_dcr_register(env, OCM0_ISACNTL, + ocm, &dcr_read_ocm, &dcr_write_ocm); + ppc_dcr_register(env, OCM0_DSARC, + ocm, &dcr_read_ocm, &dcr_write_ocm); + ppc_dcr_register(env, OCM0_DSACNTL, + ocm, &dcr_read_ocm, &dcr_write_ocm); } /*****************************************************************************/ @@ -1286,17 +1272,15 @@ ppc4xx_i2c_t *i2c; i2c = qemu_mallocz(sizeof(ppc4xx_i2c_t)); - if (i2c != NULL) { - i2c->base = offset; - i2c->irq = irq; - ppc4xx_i2c_reset(i2c); + i2c->base = offset; + i2c->irq = irq; + ppc4xx_i2c_reset(i2c); #ifdef DEBUG_I2C - printf("%s: offset " PADDRX "\n", __func__, offset); + printf("%s: offset " PADDRX "\n", __func__, offset); #endif - ppc4xx_mmio_register(env, mmio, offset, 0x011, - i2c_read, i2c_write, i2c); - qemu_register_reset(ppc4xx_i2c_reset, i2c); - } + ppc4xx_mmio_register(env, mmio, offset, 0x011, + i2c_read, i2c_write, i2c); + qemu_register_reset(ppc4xx_i2c_reset, i2c); } /*****************************************************************************/ @@ -1568,19 +1552,17 @@ int i; gpt = qemu_mallocz(sizeof(ppc4xx_gpt_t)); - if (gpt != NULL) { - gpt->base = offset; - for (i = 0; i < 5; i++) - gpt->irqs[i] = irqs[i]; - gpt->timer = qemu_new_timer(vm_clock, &ppc4xx_gpt_cb, gpt); - ppc4xx_gpt_reset(gpt); + gpt->base = offset; + for (i = 0; i < 5; i++) + gpt->irqs[i] = irqs[i]; + gpt->timer = qemu_new_timer(vm_clock, &ppc4xx_gpt_cb, gpt); + ppc4xx_gpt_reset(gpt); #ifdef DEBUG_GPT - printf("%s: offset " PADDRX "\n", __func__, offset); + printf("%s: offset " PADDRX "\n", __func__, offset); #endif - ppc4xx_mmio_register(env, mmio, offset, 0x0D4, - gpt_read, gpt_write, gpt); - qemu_register_reset(ppc4xx_gpt_reset, gpt); - } + ppc4xx_mmio_register(env, mmio, offset, 0x0D4, + gpt_read, gpt_write, gpt); + qemu_register_reset(ppc4xx_gpt_reset, gpt); } /*****************************************************************************/ @@ -1802,50 +1784,48 @@ int i; mal = qemu_mallocz(sizeof(ppc40x_mal_t)); - if (mal != NULL) { - for (i = 0; i < 4; i++) - mal->irqs[i] = irqs[i]; - ppc40x_mal_reset(mal); - qemu_register_reset(&ppc40x_mal_reset, mal); - ppc_dcr_register(env, MAL0_CFG, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_ESR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_IER, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXCASR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXCARR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXEOBISR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXDEIR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RXCASR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RXCARR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RXEOBISR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RXDEIR, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXCTP0R, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXCTP1R, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXCTP2R, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_TXCTP3R, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RXCTP0R, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RXCTP1R, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RCBS0, - mal, &dcr_read_mal, &dcr_write_mal); - ppc_dcr_register(env, MAL0_RCBS1, - mal, &dcr_read_mal, &dcr_write_mal); - } + for (i = 0; i < 4; i++) + mal->irqs[i] = irqs[i]; + ppc40x_mal_reset(mal); + qemu_register_reset(&ppc40x_mal_reset, mal); + ppc_dcr_register(env, MAL0_CFG, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_ESR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_IER, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXCASR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXCARR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXEOBISR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXDEIR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RXCASR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RXCARR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RXEOBISR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RXDEIR, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXCTP0R, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXCTP1R, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXCTP2R, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_TXCTP3R, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RXCTP0R, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RXCTP1R, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RCBS0, + mal, &dcr_read_mal, &dcr_write_mal); + ppc_dcr_register(env, MAL0_RCBS1, + mal, &dcr_read_mal, &dcr_write_mal); } /*****************************************************************************/ @@ -2170,31 +2150,29 @@ ppc405cr_cpc_t *cpc; cpc = qemu_mallocz(sizeof(ppc405cr_cpc_t)); - if (cpc != NULL) { - memcpy(cpc->clk_setup, clk_setup, - PPC405CR_CLK_NB * sizeof(clk_setup_t)); - cpc->sysclk = sysclk; - cpc->jtagid = 0x42051049; - ppc_dcr_register(env, PPC405CR_CPC0_PSR, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_CR0, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_CR1, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_JTAGID, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_PLLMR, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_ER, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_FR, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc_dcr_register(env, PPC405CR_CPC0_SR, cpc, - &dcr_read_crcpc, &dcr_write_crcpc); - ppc405cr_clk_init(cpc); - qemu_register_reset(ppc405cr_cpc_reset, cpc); - ppc405cr_cpc_reset(cpc); - } + memcpy(cpc->clk_setup, clk_setup, + PPC405CR_CLK_NB * sizeof(clk_setup_t)); + cpc->sysclk = sysclk; + cpc->jtagid = 0x42051049; + ppc_dcr_register(env, PPC405CR_CPC0_PSR, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_CR0, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_CR1, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_JTAGID, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_PLLMR, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_ER, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_FR, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc_dcr_register(env, PPC405CR_CPC0_SR, cpc, + &dcr_read_crcpc, &dcr_write_crcpc); + ppc405cr_clk_init(cpc); + qemu_register_reset(ppc405cr_cpc_reset, cpc); + ppc405cr_cpc_reset(cpc); } CPUState *ppc405cr_init (target_phys_addr_t ram_bases[4], @@ -2516,38 +2494,36 @@ ppc405ep_cpc_t *cpc; cpc = qemu_mallocz(sizeof(ppc405ep_cpc_t)); - if (cpc != NULL) { - memcpy(cpc->clk_setup, clk_setup, - PPC405EP_CLK_NB * sizeof(clk_setup_t)); - cpc->jtagid = 0x20267049; - cpc->sysclk = sysclk; - ppc405ep_cpc_reset(cpc); - qemu_register_reset(&ppc405ep_cpc_reset, cpc); - ppc_dcr_register(env, PPC405EP_CPC0_BOOT, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_EPCTL, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_PLLMR0, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_PLLMR1, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_UCR, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_SRR, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_JTAGID, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_PCI, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); + memcpy(cpc->clk_setup, clk_setup, + PPC405EP_CLK_NB * sizeof(clk_setup_t)); + cpc->jtagid = 0x20267049; + cpc->sysclk = sysclk; + ppc405ep_cpc_reset(cpc); + qemu_register_reset(&ppc405ep_cpc_reset, cpc); + ppc_dcr_register(env, PPC405EP_CPC0_BOOT, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_EPCTL, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_PLLMR0, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_PLLMR1, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_UCR, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_SRR, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_JTAGID, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_PCI, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); #if 0 - ppc_dcr_register(env, PPC405EP_CPC0_ER, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_FR, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); - ppc_dcr_register(env, PPC405EP_CPC0_SR, cpc, - &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_ER, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_FR, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); + ppc_dcr_register(env, PPC405EP_CPC0_SR, cpc, + &dcr_read_epcpc, &dcr_write_epcpc); #endif - } } CPUState *ppc405ep_init (target_phys_addr_t ram_bases[2], Modified: trunk/hw/ppc440_bamboo.c =================================================================== --- trunk/hw/ppc440_bamboo.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc440_bamboo.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -42,8 +42,6 @@ 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); Modified: trunk/hw/ppc4xx_devs.c =================================================================== --- trunk/hw/ppc4xx_devs.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc4xx_devs.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -246,18 +246,16 @@ int mmio_memory; mmio = qemu_mallocz(sizeof(ppc4xx_mmio_t)); - if (mmio != NULL) { - mmio->base = base; - mmio_memory = cpu_register_io_memory(0, mmio_read, mmio_write, mmio); + mmio->base = base; + mmio_memory = cpu_register_io_memory(0, mmio_read, mmio_write, mmio); #if defined(DEBUG_MMIO) - printf("%s: base " PADDRX " len %08x %d\n", __func__, - base, TARGET_PAGE_SIZE, mmio_memory); + printf("%s: base " PADDRX " len %08x %d\n", __func__, + base, TARGET_PAGE_SIZE, mmio_memory); #endif - cpu_register_physical_memory(base, TARGET_PAGE_SIZE, mmio_memory); - ppc4xx_mmio_register(env, mmio, 0, TARGET_PAGE_SIZE, - unassigned_mmio_read, unassigned_mmio_write, - mmio); - } + cpu_register_physical_memory(base, TARGET_PAGE_SIZE, mmio_memory); + ppc4xx_mmio_register(env, mmio, 0, TARGET_PAGE_SIZE, + unassigned_mmio_read, unassigned_mmio_write, + mmio); return mmio; } @@ -492,18 +490,16 @@ int i; uic = qemu_mallocz(sizeof(ppcuic_t)); - if (uic != NULL) { - uic->dcr_base = dcr_base; - uic->irqs = irqs; - if (has_vr) - uic->use_vectors = 1; - for (i = 0; i < DCR_UICMAX; i++) { - ppc_dcr_register(env, dcr_base + i, uic, - &dcr_read_uic, &dcr_write_uic); - } - qemu_register_reset(ppcuic_reset, uic); - ppcuic_reset(uic); + uic->dcr_base = dcr_base; + uic->irqs = irqs; + if (has_vr) + uic->use_vectors = 1; + for (i = 0; i < DCR_UICMAX; i++) { + ppc_dcr_register(env, dcr_base + i, uic, + &dcr_read_uic, &dcr_write_uic); } + qemu_register_reset(ppcuic_reset, uic); + ppcuic_reset(uic); return qemu_allocate_irqs(&ppcuic_set_irq, uic, UIC_MAX_IRQ); } @@ -829,24 +825,22 @@ ppc4xx_sdram_t *sdram; sdram = qemu_mallocz(sizeof(ppc4xx_sdram_t)); - if (sdram != NULL) { - sdram->irq = irq; - sdram->nbanks = nbanks; - memset(sdram->ram_bases, 0, 4 * sizeof(target_phys_addr_t)); - memcpy(sdram->ram_bases, ram_bases, - nbanks * sizeof(target_phys_addr_t)); - memset(sdram->ram_sizes, 0, 4 * sizeof(target_phys_addr_t)); - memcpy(sdram->ram_sizes, ram_sizes, - nbanks * sizeof(target_phys_addr_t)); - sdram_reset(sdram); - qemu_register_reset(&sdram_reset, sdram); - ppc_dcr_register(env, SDRAM0_CFGADDR, - sdram, &dcr_read_sdram, &dcr_write_sdram); - ppc_dcr_register(env, SDRAM0_CFGDATA, - sdram, &dcr_read_sdram, &dcr_write_sdram); - if (do_init) - sdram_map_bcr(sdram); - } + sdram->irq = irq; + sdram->nbanks = nbanks; + memset(sdram->ram_bases, 0, 4 * sizeof(target_phys_addr_t)); + memcpy(sdram->ram_bases, ram_bases, + nbanks * sizeof(target_phys_addr_t)); + memset(sdram->ram_sizes, 0, 4 * sizeof(target_phys_addr_t)); + memcpy(sdram->ram_sizes, ram_sizes, + nbanks * sizeof(target_phys_addr_t)); + sdram_reset(sdram); + qemu_register_reset(&sdram_reset, sdram); + ppc_dcr_register(env, SDRAM0_CFGADDR, + sdram, &dcr_read_sdram, &dcr_write_sdram); + ppc_dcr_register(env, SDRAM0_CFGDATA, + sdram, &dcr_read_sdram, &dcr_write_sdram); + if (do_init) + sdram_map_bcr(sdram); } /* Fill in consecutive SDRAM banks with 'ram_size' bytes of memory. Modified: trunk/hw/ppc4xx_pci.c =================================================================== --- trunk/hw/ppc4xx_pci.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc4xx_pci.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -369,8 +369,6 @@ uint8_t *pci_conf; controller = qemu_mallocz(sizeof(PPC4xxPCIState)); - if (!controller) - return NULL; controller->pci_state.bus = pci_register_bus(ppc4xx_pci_set_irq, ppc4xx_pci_map_irq, Modified: trunk/hw/ppc_prep.c =================================================================== --- trunk/hw/ppc_prep.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/ppc_prep.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -553,8 +553,6 @@ BlockDriverState *fd[MAX_FD]; sysctrl = qemu_mallocz(sizeof(sysctrl_t)); - if (sysctrl == NULL) - return; linux_boot = (kernel_filename != NULL); Modified: trunk/hw/r2d.c =================================================================== --- trunk/hw/r2d.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/r2d.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -170,8 +170,6 @@ r2d_fpga_t *s; s = qemu_mallocz(sizeof(r2d_fpga_t)); - if (!s) - return NULL; s->irl = irl; Modified: trunk/hw/rc4030.c =================================================================== --- trunk/hw/rc4030.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/rc4030.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -718,8 +718,6 @@ int s_chipset, s_jazzio; s = qemu_mallocz(sizeof(rc4030State)); - if (!s) - return NULL; *dmas = rc4030_allocate_dmas(s, 4); *dma_read = rc4030_dma_read; Modified: trunk/hw/sb16.c =================================================================== --- trunk/hw/sb16.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/sb16.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -1411,11 +1411,6 @@ } s = qemu_mallocz (sizeof (*s)); - if (!s) { - dolog ("Could not allocate memory for SB16 (%zu bytes)\n", - sizeof (*s)); - return -1; - } s->cmd = -1; s->pic = pic; Modified: trunk/hw/sbi.c =================================================================== --- trunk/hw/sbi.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/sbi.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -146,8 +146,6 @@ SBIState *s; s = qemu_mallocz(sizeof(SBIState)); - if (!s) - return NULL; for (i = 0; i < MAX_CPUS; i++) { s->cpu_irqs[i] = parent_irq[i]; Modified: trunk/hw/serial.c =================================================================== --- trunk/hw/serial.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/serial.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -732,8 +732,6 @@ SerialState *s; s = qemu_mallocz(sizeof(SerialState)); - if (!s) - return NULL; serial_init_core(s, irq, baudbase, chr); @@ -824,8 +822,6 @@ int s_io_memory; s = qemu_mallocz(sizeof(SerialState)); - if (!s) - return NULL; s->it_shift = it_shift; Modified: trunk/hw/sh_intc.c =================================================================== --- trunk/hw/sh_intc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/sh_intc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -432,9 +432,7 @@ desc->nr_prio_regs = nr_prio_regs; i = sizeof(struct intc_source) * nr_sources; - desc->sources = malloc(i); - if (!desc->sources) - return -1; + desc->sources = qemu_malloc(i); memset(desc->sources, 0, i); for (i = 0; i < desc->nr_sources; i++) { Modified: trunk/hw/sh_serial.c =================================================================== --- trunk/hw/sh_serial.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/sh_serial.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -376,8 +376,6 @@ int s_io_memory; s = qemu_mallocz(sizeof(sh_serial_state)); - if (!s) - return; s->feat = feat; s->flags = SH_SERIAL_FLAG_TEND | SH_SERIAL_FLAG_TDE; Modified: trunk/hw/slavio_intctl.c =================================================================== --- trunk/hw/slavio_intctl.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/slavio_intctl.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -381,14 +381,10 @@ SLAVIO_CPUINTCTLState *slave; s = qemu_mallocz(sizeof(SLAVIO_INTCTLState)); - if (!s) - return NULL; s->intbit_to_level = intbit_to_level; for (i = 0; i < MAX_CPUS; i++) { slave = qemu_mallocz(sizeof(SLAVIO_CPUINTCTLState)); - if (!slave) - return NULL; slave->cpu = i; slave->master = s; Modified: trunk/hw/slavio_misc.c =================================================================== --- trunk/hw/slavio_misc.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/slavio_misc.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -446,8 +446,6 @@ MiscState *s; s = qemu_mallocz(sizeof(MiscState)); - if (!s) - return NULL; if (base) { /* 8 bit registers */ Modified: trunk/hw/slavio_timer.c =================================================================== --- trunk/hw/slavio_timer.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/slavio_timer.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -372,8 +372,6 @@ QEMUBH *bh; s = qemu_mallocz(sizeof(SLAVIO_TIMERState)); - if (!s) - return s; s->irq = irq; s->master = master; s->slave_index = slave_index; Modified: trunk/hw/sparc32_dma.c =================================================================== --- trunk/hw/sparc32_dma.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/sparc32_dma.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -248,8 +248,6 @@ int dma_io_memory; s = qemu_mallocz(sizeof(DMAState)); - if (!s) - return NULL; s->irq = parent_irq; s->iommu = iommu; Modified: trunk/hw/sun4c_intctl.c =================================================================== --- trunk/hw/sun4c_intctl.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/sun4c_intctl.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -204,8 +204,6 @@ Sun4c_INTCTLState *s; s = qemu_mallocz(sizeof(Sun4c_INTCTLState)); - if (!s) - return NULL; sun4c_intctl_io_memory = cpu_register_io_memory(0, sun4c_intctl_mem_read, sun4c_intctl_mem_write, s); Modified: trunk/hw/tcx.c =================================================================== --- trunk/hw/tcx.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/tcx.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -499,8 +499,6 @@ int size; s = qemu_mallocz(sizeof(TCXState)); - if (!s) - return; s->addr = addr; s->vram_offset = vram_offset; s->width = width; Modified: trunk/hw/usb-bt.c =================================================================== --- trunk/hw/usb-bt.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-bt.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -625,8 +625,6 @@ if (!hci) return NULL; s = qemu_mallocz(sizeof(struct USBBtState)); - if (!s) - return NULL; s->dev.opaque = s; s->dev.speed = USB_SPEED_HIGH; s->dev.handle_packet = usb_generic_handle_packet; Modified: trunk/hw/usb-hid.c =================================================================== --- trunk/hw/usb-hid.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-hid.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -851,8 +851,6 @@ USBHIDState *s; s = qemu_mallocz(sizeof(USBHIDState)); - if (!s) - return NULL; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_generic_handle_packet; @@ -874,8 +872,6 @@ USBHIDState *s; s = qemu_mallocz(sizeof(USBHIDState)); - if (!s) - return NULL; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_generic_handle_packet; @@ -897,8 +893,6 @@ USBHIDState *s; s = qemu_mallocz(sizeof(USBHIDState)); - if (!s) - return NULL; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_generic_handle_packet; Modified: trunk/hw/usb-hub.c =================================================================== --- trunk/hw/usb-hub.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-hub.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -530,8 +530,6 @@ if (nb_ports > MAX_PORTS) return NULL; s = qemu_mallocz(sizeof(USBHubState)); - if (!s) - return NULL; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_hub_handle_packet; Modified: trunk/hw/usb-msd.c =================================================================== --- trunk/hw/usb-msd.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-msd.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -548,8 +548,6 @@ } s = qemu_mallocz(sizeof(MSDState)); - if (!s) - return NULL; bdrv = bdrv_new("usb"); if (bdrv_open2(bdrv, filename, 0, drv) < 0) Modified: trunk/hw/usb-net.c =================================================================== --- trunk/hw/usb-net.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-net.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -1430,8 +1430,6 @@ USBNetState *s; s = qemu_mallocz(sizeof(USBNetState)); - if (!s) - return NULL; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_generic_handle_packet; Modified: trunk/hw/usb-serial.c =================================================================== --- trunk/hw/usb-serial.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-serial.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -554,8 +554,6 @@ } filename++; s = qemu_mallocz(sizeof(USBSerialState)); - if (!s) - return NULL; snprintf(label, sizeof(label), "usbserial%d", index++); cdrv = qemu_chr_open(label, filename, NULL); Modified: trunk/hw/usb-uhci.c =================================================================== --- trunk/hw/usb-uhci.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-uhci.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -155,15 +155,14 @@ static UHCIAsync *uhci_async_alloc(UHCIState *s) { UHCIAsync *async = qemu_malloc(sizeof(UHCIAsync)); - if (async) { - memset(&async->packet, 0, sizeof(async->packet)); - async->valid = 0; - async->td = 0; - async->token = 0; - async->done = 0; - async->next = NULL; - } + memset(&async->packet, 0, sizeof(async->packet)); + async->valid = 0; + async->td = 0; + async->token = 0; + async->done = 0; + async->next = NULL; + return async; } Modified: trunk/hw/usb-wacom.c =================================================================== --- trunk/hw/usb-wacom.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/usb-wacom.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -397,8 +397,6 @@ USBWacomState *s; s = qemu_mallocz(sizeof(USBWacomState)); - if (!s) - return NULL; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_generic_handle_packet; Modified: trunk/hw/versatilepb.c =================================================================== --- trunk/hw/versatilepb.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/versatilepb.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -135,8 +135,6 @@ int iomemtype; s = (vpb_sic_state *)qemu_mallocz(sizeof(vpb_sic_state)); - if (!s) - return NULL; qi = qemu_allocate_irqs(vpb_sic_set_irq, s, 32); s->parent = parent; s->irq = irq; Modified: trunk/hw/vga.c =================================================================== --- trunk/hw/vga.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/vga.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -2444,8 +2444,6 @@ VGAState *s; s = qemu_mallocz(sizeof(VGAState)); - if (!s) - return -1; vga_common_init(s, vga_ram_base, vga_ram_offset, vga_ram_size); vga_init(s); @@ -2469,8 +2467,6 @@ VGAState *s; s = qemu_mallocz(sizeof(VGAState)); - if (!s) - return -1; vga_common_init(s, vga_ram_base, vga_ram_offset, vga_ram_size); vga_mm_init(s, vram_base, ctrl_base, it_shift); Modified: trunk/hw/virtio-blk.c =================================================================== --- trunk/hw/virtio-blk.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/virtio-blk.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -104,8 +104,7 @@ static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s) { VirtIOBlockReq *req = qemu_mallocz(sizeof(*req)); - if (req != NULL) - req->dev = s; + req->dev = s; return req; } Modified: trunk/hw/virtio.c =================================================================== --- trunk/hw/virtio.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/virtio.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -447,8 +447,7 @@ sg->iov_len = 2 << 20; sg->iov_base = qemu_malloc(sg->iov_len); - if (sg->iov_base && - !(vring_desc_flags(vq, i) & VRING_DESC_F_WRITE)) { + if (!(vring_desc_flags(vq, i) & VRING_DESC_F_WRITE)) { cpu_physical_memory_read(vring_desc_addr(vq, i), sg->iov_base, sg->iov_len); Modified: trunk/hw/vmmouse.c =================================================================== --- trunk/hw/vmmouse.c 2009-02-05 22:05:58 UTC (rev 6528) +++ trunk/hw/vmmouse.c 2009-02-05 22:06:05 UTC (rev 6529) @@ -275,8 +275,6 @@ DPRINTF("vmmouse_init\n"); s = qemu_mallocz(sizeof(VMMouseState)); - if (!s) - return NULL; s->status = 0xffff; s->ps2_mouse = m;