[6529] hw: remove error handling from qemu_malloc() callers (Avi Kivity)
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)
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.cModified: trunk/hw/adlib.c
===================================================================
hw/adlib.c +0 -7
@@ -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
===================================================================
hw/apic.c +0 -4
@@ -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
===================================================================
hw/arm_gic.c +0 -2
@@ -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
===================================================================
hw/arm_sysctl.c +0 -2
@@ -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
===================================================================
hw/baum.c +0 -10
@@ -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
===================================================================
hw/cs4231.c +0 -2
@@ -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
===================================================================
hw/cs4231a.c +0 -5
@@ -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
===================================================================
hw/ds1225y.c +0 -5
@@ -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
===================================================================
hw/eccmemctl.c +0 -2
@@ -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
===================================================================
hw/escc.c +0 -4
@@ -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
===================================================================
hw/esp.c +0 -2
@@ -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
===================================================================
hw/etraxfs_dma.c +0 -8
@@ -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
===================================================================
hw/etraxfs_eth.c +0 -8
@@ -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
===================================================================
hw/etraxfs_pic.c +0 -6
@@ -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
===================================================================
hw/etraxfs_ser.c +0 -2
@@ -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
===================================================================
hw/etraxfs_timer.c +0 -2
@@ -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
===================================================================
hw/fdc.c +0 -6
@@ -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
===================================================================
hw/fmopl.c +5 -22
@@ -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 <<TL_BITS )-1 )/pow (10 ,EG_STEP *t/20 );/* dB -> 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
===================================================================
hw/fw_cfg.c +0 -8
@@ -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
===================================================================
hw/g364fb.c +0 -2
@@ -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
===================================================================
hw/gus.c +0 -11
@@ -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
===================================================================
hw/i8259.c +0 -2
@@ -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
===================================================================
hw/ide.c +0 -2
@@ -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
===================================================================
hw/integratorcp.c +0 -2
@@ -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
===================================================================
hw/iommu.c +0 -2
@@ -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
===================================================================
hw/jazz_led.c +0 -2
@@ -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
===================================================================
hw/m48t59.c +0 -6
@@ -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
===================================================================
hw/mac_dbdma.c +0 -2
@@ -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
===================================================================
hw/mac_nvram.c +0 -6
@@ -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
===================================================================
hw/mc146818rtc.c +0 -4
@@ -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
===================================================================
hw/mipsnet.c +0 -2
@@ -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
===================================================================
hw/mpcore.c +0 -2
@@ -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
===================================================================
hw/mst_fpga.c +0 -2
@@ -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
===================================================================
hw/musicpal.c +0 -14
@@ -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
===================================================================
hw/ne2000.c +0 -2
@@ -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
===================================================================
hw/parallel.c +0 -4
@@ -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
===================================================================
hw/pci.c +0 -2
@@ -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
===================================================================
hw/pcnet.c +0 -2
@@ -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
===================================================================
hw/pflash_cfi01.c +0 -2
@@ -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
===================================================================
hw/pflash_cfi02.c +0 -2
@@ -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
===================================================================
hw/pl031.c +0 -2
@@ -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
===================================================================
hw/ppc.c +0 -7
@@ -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
===================================================================
hw/ppc405_boards.c +10 -14
@@ -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
===================================================================
hw/ppc405_uc.c +199 -223
504 lines not on this page · raw message
Modified: trunk/hw/ppc440_bamboo.c
===================================================================
hw/ppc440_bamboo.c +0 -2
@@ -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
===================================================================
hw/ppc4xx_devs.c +33 -39
93 lines not on this page · raw message
Modified: trunk/hw/ppc4xx_pci.c
===================================================================
hw/ppc4xx_pci.c +0 -2
@@ -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
===================================================================
hw/ppc_prep.c +0 -2
@@ -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
===================================================================
hw/r2d.c +0 -2
@@ -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
===================================================================
hw/rc4030.c +0 -2
@@ -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
===================================================================
hw/sb16.c +0 -5
@@ -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
===================================================================
hw/sbi.c +0 -2
@@ -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
===================================================================
hw/serial.c +0 -4
@@ -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
===================================================================
hw/sh_intc.c +1 -3
@@ -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
===================================================================
hw/sh_serial.c +0 -2
@@ -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
===================================================================
hw/slavio_intctl.c +0 -4
@@ -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
===================================================================
hw/slavio_misc.c +0 -2
@@ -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
===================================================================
hw/slavio_timer.c +0 -2
@@ -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
===================================================================
hw/sparc32_dma.c +0 -2
@@ -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
===================================================================
hw/sun4c_intctl.c +0 -2
@@ -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
===================================================================
hw/tcx.c +0 -2
@@ -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
===================================================================
hw/usb-bt.c +0 -2
@@ -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
===================================================================
hw/usb-hid.c +0 -6
@@ -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
===================================================================
hw/usb-hub.c +0 -2
@@ -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
===================================================================
hw/usb-msd.c +0 -2
@@ -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
===================================================================
hw/usb-net.c +0 -2
@@ -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
===================================================================
hw/usb-serial.c +0 -2
@@ -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
===================================================================
hw/usb-uhci.c +7 -8
@@ -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
===================================================================
hw/usb-wacom.c +0 -2
@@ -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
===================================================================
hw/versatilepb.c +0 -2
@@ -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
===================================================================
hw/vga.c +0 -4
@@ -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
===================================================================
hw/virtio-blk.c +1 -2
@@ -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
===================================================================
hw/virtio.c +1 -2
@@ -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
===================================================================
hw/vmmouse.c +0 -2
@@ -275,8 +275,6 @@DPRINTF ("vmmouse_init\n" ); s =qemu_mallocz (sizeof (VMMouseState)); -if (!s) -return NULL ; s->status =0xffff ; s->ps2_mouse = m;