two little build fixes
PATCH v2 2/2 scsi: fix warning
In reply to Gerd Hoffmannhw/scsi-bus.c:758: warning: ‘xfer’ may be used uninitialized in this function
Isn't true, but older gcc versions (for example 4.1 as shipped in rhel5) are not clever enougth to figure, so sprinkle in a default: line to make them happy.
--- hw/scsi-bus.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/scsi-bus.c +2 -0
@@ -761,6 +761,7 @@ static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf)switch (length) {case 0 :case 3 :/* USB-specific. */ +default : xfer =0 ;break ;case 1 :
@@ -784,6 +785,7 @@ static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)switch (length) {case 0 :case 3 :/* USB-specific. */ +default : xfer =0 ;break ;case 1 :
Signature · 1 line
1.7.1
v2 cover two little build fixes
Hi,
Patch #1 uses g_strdup_printf now, #2 is unchanged.
cheers,
Gerd
Gerd Hoffmann (2):
Avoid asprintf() which is not available on mingw
scsi: fix warning
hw/msix.c | 8 ++------ hw/scsi-bus.c | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-)
PATCH v2 1/2 Avoid asprintf() which is not available on mingw
Use g_strdup_printf() instead.
--- hw/msix.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
hw/msix.c +2 -6
@@ -307,13 +307,9 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,return -EINVAL ; } -if (asprintf (&name,"%s-msix" , dev->name) ==-1 ) { -return -ENOMEM ; - } - + name =g_strdup_printf ("%s-msix" , dev->name);memory_region_init (&dev->msix_exclusive_bar, name,MSIX_EXCLUSIVE_BAR_SIZE ); - -free (name); +g_free (name); ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr, MSIX_EXCLUSIVE_BAR_TABLE_OFFSET, &dev->msix_exclusive_bar,
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH v2 1/2] Avoid asprintf() which is not available on mingw
Am 13.08.2012 13:05, schrieb Gerd Hoffmann:
Quoted 17 lines
Use
g_strdup_printf()instead.Signed-off-by Gerd Hoffmann <[email protected]>--- hw/msix.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)hw/msix.c +0
-2@@ -307,13 +307,9 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,return -EINVAL ; } -if (asprintf (&name,"%s-msix" , dev->name) ==-1 ) { -return -ENOMEM ;
hw/msix.c int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, · line 315
Quoted 10 lines
hw/msix.c +2
-4- } - + name =g_strdup_printf ("%s-msix" , dev->name);memory_region_init (&dev->msix_exclusive_bar, name,MSIX_EXCLUSIVE_BAR_SIZE ); - -free (name); +g_free (name); ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr, MSIX_EXCLUSIVE_BAR_TABLE_OFFSET, &dev->msix_exclusive_bar,
Blue Swirl
AppliedQuoted 3 lines · Gerd Hoffmann
Hi,
Patch #1 uses
g_strdup_printfnow, #2 is unchanged.
Thanks, applied both.
Quoted 13 lines
cheers,
GerdGerd Hoffmann (2):
Avoidasprintf()which is not available on mingw
scsi: fix warninghw/msix.c | 8 ++------ hw/scsi-bus.c | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-)