Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for…
Browse files Browse the repository at this point in the history
…-5.1-pull-request' into staging

trivial patches (20200504)

Silent static analyzer warning
Remove dead assignments
Support -chardev serial on macOS
Update MAINTAINERS
Some cosmetic changes

# gpg: Signature made Mon 04 May 2020 16:45:18 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier <[email protected]>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <[email protected]>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/trivial-branch-for-5.1-pull-request:
  hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
  hw/timer/stm32f2xx_timer: Remove dead assignment
  hw/gpio/aspeed_gpio: Remove dead assignment
  hw/isa/i82378: Remove dead assignment
  hw/ide/sii3112: Remove dead assignment
  hw/input/adb-kbd: Remove dead assignment
  hw/i2c/pm_smbus: Remove dead assignment
  blockdev: Remove dead assignment
  block: Avoid dead assignment
  Compress lines for immediate return
  chardev: Add macOS to list of OSes that support -chardev serial
  MAINTAINERS: Update Keith Busch's email address
  elf_ops: Don't try to g_mapped_file_unref(NULL)
  hw/mem/pc-dimm: Fix line over 80 characters warning
  hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug()
  MAINTAINERS: Mark the LatticeMico32 target as orphan
  timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write()
  display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32()
  scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write()

Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
pm215 committed May 5, 2020
2 parents 5c7c46f + e702fba commit a2261b2
Show file tree
Hide file tree
Showing 27 changed files with 45 additions and 70 deletions.
14 changes: 7 additions & 7 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ F: hw/net/*i82596*
F: include/hw/net/lasi_82596.h

LM32 TCG CPUs
M: Michael Walle <[email protected]>
S: Maintained
R: Michael Walle <[email protected]>
S: Orphan
F: target/lm32/
F: disas/lm32.c
F: hw/lm32/
Expand Down Expand Up @@ -977,13 +977,13 @@ F: pc-bios/hppa-firmware.img
LM32 Machines
-------------
EVR32 and uclinux BSP
M: Michael Walle <[email protected]>
S: Maintained
R: Michael Walle <[email protected]>
S: Orphan
F: hw/lm32/lm32_boards.c

milkymist
M: Michael Walle <[email protected]>
S: Maintained
R: Michael Walle <[email protected]>
S: Orphan
F: hw/lm32/milkymist.c

M68K Machines
Expand Down Expand Up @@ -1735,7 +1735,7 @@ F: hw/virtio/virtio-crypto-pci.c
F: include/hw/virtio/virtio-crypto.h

nvme
M: Keith Busch <[email protected]>
M: Keith Busch <[email protected]>
L: [email protected]
S: Supported
F: hw/block/nvme*
Expand Down
2 changes: 1 addition & 1 deletion block.c
Original file line number Diff line number Diff line change
Expand Up @@ -3165,7 +3165,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
}

ret = bdrv_fill_options(&options, filename, &flags, &local_err);
if (local_err) {
if (ret < 0) {
goto fail;
}

Expand Down
8 changes: 3 additions & 5 deletions block/file-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1617,22 +1617,20 @@ static int handle_aiocb_write_zeroes_unmap(void *opaque)
{
RawPosixAIOData *aiocb = opaque;
BDRVRawState *s G_GNUC_UNUSED = aiocb->bs->opaque;
int ret;

/* First try to write zeros and unmap at the same time */

#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
aiocb->aio_offset, aiocb->aio_nbytes);
int ret = do_fallocate(s->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
aiocb->aio_offset, aiocb->aio_nbytes);
if (ret != -ENOTSUP) {
return ret;
}
#endif

/* If we couldn't manage to unmap while guaranteed that the area reads as
* all-zero afterwards, just write zeroes without unmapping */
ret = handle_aiocb_write_zeroes(aiocb);
return ret;
return handle_aiocb_write_zeroes(aiocb);
}

#ifndef HAVE_COPY_FILE_RANGE
Expand Down
3 changes: 1 addition & 2 deletions block/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,7 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
}

bs->total_sectors = ret;
ret = 0;
return ret;
return 0;
}

static QemuOptsList nfs_create_opts = {
Expand Down
4 changes: 1 addition & 3 deletions block/nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,11 +575,9 @@ static bool nvme_poll_cb(void *opaque)
{
EventNotifier *e = opaque;
BDRVNVMeState *s = container_of(e, BDRVNVMeState, irq_notifier);
bool progress = false;

trace_nvme_poll_cb(s);
progress = nvme_poll_queues(s);
return progress;
return nvme_poll_queues(s);
}

static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
Expand Down
3 changes: 1 addition & 2 deletions block/vhdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,7 @@ int vhdx_update_headers(BlockDriverState *bs, BDRVVHDXState *s,
if (ret < 0) {
return ret;
}
ret = vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
return ret;
return vhdx_update_header(bs, s, generate_data_write_guid, log_guid);
}

/* opens the specified header block from the VHDX file header section */
Expand Down
2 changes: 1 addition & 1 deletion blockdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2741,7 +2741,7 @@ void qmp_block_resize(bool has_device, const char *device,
}

bdrv_drained_begin(bs);
ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
blk_truncate(blk, size, false, PREALLOC_MODE_OFF, 0, errp);
bdrv_drained_end(bs);

out:
Expand Down
2 changes: 1 addition & 1 deletion chardev/char-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void qmp_chardev_open_serial(Chardev *chr,

#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
|| defined(__GLIBC__)
|| defined(__GLIBC__) || defined(__APPLE__)

static void tty_serial_init(int fd, int speed,
int parity, int data_bits, int stop_bits)
Expand Down
4 changes: 1 addition & 3 deletions hw/audio/ac97.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,11 +573,9 @@ static uint32_t nam_readb (void *opaque, uint32_t addr)
static uint32_t nam_readw (void *opaque, uint32_t addr)
{
AC97LinkState *s = opaque;
uint32_t val = ~0U;
uint32_t index = addr;
s->cas = 0;
val = mixer_load (s, index);
return val;
return mixer_load(s, index);
}

static uint32_t nam_readl (void *opaque, uint32_t addr)
Expand Down
5 changes: 1 addition & 4 deletions hw/audio/adlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,10 @@ static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
static uint32_t adlib_read(void *opaque, uint32_t nport)
{
AdlibState *s = opaque;
uint8_t data;
int a = nport & 3;

adlib_kill_timers (s);
data = OPLRead (s->opl, a);

return data;
return OPLRead (s->opl, a);
}

static void timer_handler (void *opaque, int c, double interval_Sec)
Expand Down
10 changes: 4 additions & 6 deletions hw/display/blizzard.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include "qemu/bitops.h"
#include "ui/console.h"
#include "hw/display/blizzard.h"
#include "ui/pixel_ops.h"
Expand Down Expand Up @@ -932,12 +933,9 @@ static void blizzard_draw_line16_32(uint32_t *dest,
const uint16_t *end = (const void *) src + width;
while (src < end) {
data = *src ++;
b = (data & 0x1f) << 3;
data >>= 5;
g = (data & 0x3f) << 2;
data >>= 6;
r = (data & 0x1f) << 3;
data >>= 5;
b = extract16(data, 0, 5) << 3;
g = extract16(data, 5, 6) << 2;
r = extract16(data, 11, 5) << 3;
*dest++ = rgb_to_pixel32(r, g, b);
}
}
Expand Down
4 changes: 1 addition & 3 deletions hw/display/cirrus_vga.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,12 +2411,10 @@ static uint64_t cirrus_linear_bitblt_read(void *opaque,
unsigned size)
{
CirrusVGAState *s = opaque;
uint32_t ret;

/* XXX handle bitblt */
(void)s;
ret = 0xff;
return ret;
return 0xff;
}

static void cirrus_linear_bitblt_write(void *opaque,
Expand Down
2 changes: 1 addition & 1 deletion hw/gpio/aspeed_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ static void aspeed_gpio_write(void *opaque, hwaddr offset, uint64_t data,
static int get_set_idx(AspeedGPIOState *s, const char *group, int *group_idx)
{
AspeedGPIOClass *agc = ASPEED_GPIO_GET_CLASS(s);
int set_idx, g_idx = *group_idx;
int set_idx, g_idx;

for (set_idx = 0; set_idx < agc->nr_gpio_sets; set_idx++) {
const GPIOSetProperties *set_props = &agc->props[set_idx];
Expand Down
1 change: 0 additions & 1 deletion hw/i2c/pm_smbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ static void smb_transaction(PMSMBus *s)
s->smb_stat |= STS_HOST_BUSY | STS_BYTE_DONE;
s->smb_data[0] = s->smb_blkdata;
s->smb_index = 0;
ret = 0;
}
goto out;
}
Expand Down
5 changes: 3 additions & 2 deletions hw/ide/sii3112.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr addr,
unsigned int size)
{
SiI3112PCIState *d = opaque;
uint64_t val = 0;
uint64_t val;

switch (addr) {
case 0x00:
Expand Down Expand Up @@ -126,6 +126,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr addr,
break;
default:
val = 0;
break;
}
trace_sii3112_read(size, addr, val);
return val;
Expand Down Expand Up @@ -201,7 +202,7 @@ static void sii3112_reg_write(void *opaque, hwaddr addr,
d->regs[1].sien = (val >> 16) & 0x3eed;
break;
default:
val = 0;
break;
}
}

Expand Down
6 changes: 1 addition & 5 deletions hw/input/adb-kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ static int adb_kbd_poll(ADBDevice *d, uint8_t *obuf)
{
KBDState *s = ADB_KEYBOARD(d);
int keycode;
int olen;

olen = 0;
if (s->count == 0) {
return 0;
}
Expand All @@ -216,18 +214,16 @@ static int adb_kbd_poll(ADBDevice *d, uint8_t *obuf)
if (keycode == 0x7f) {
obuf[0] = 0x7f;
obuf[1] = 0x7f;
olen = 2;
} else {
obuf[0] = keycode;
/* NOTE: the power key key-up is the two byte sequence 0xff 0xff;
* otherwise we could in theory send a second keycode in the second
* byte, but choose not to bother.
*/
obuf[1] = 0xff;
olen = 2;
}

return olen;
return 2;
}

static int adb_kbd_request(ADBDevice *d, uint8_t *obuf,
Expand Down
8 changes: 4 additions & 4 deletions hw/isa/i82378.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
I82378State *s = I82378(dev);
uint8_t *pci_conf;
ISABus *isabus;
ISADevice *isa;
ISADevice *pit;

pci_conf = pci->config;
pci_set_word(pci_conf + PCI_COMMAND,
Expand Down Expand Up @@ -99,13 +99,13 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
isa_bus_irqs(isabus, s->i8259);

/* 1 82C54 (pit) */
isa = i8254_pit_init(isabus, 0x40, 0, NULL);
pit = i8254_pit_init(isabus, 0x40, 0, NULL);

/* speaker */
pcspk_init(isabus, isa);
pcspk_init(isabus, pit);

/* 2 82C37 (dma) */
isa = isa_create_simple(isabus, "i82374");
isa_create_simple(isabus, "i82374");
}

static void i82378_init(Object *obj)
Expand Down
7 changes: 4 additions & 3 deletions hw/mem/pc-dimm.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void pc_dimm_pre_plug(PCDIMMDevice *dimm, MachineState *machine,
&error_abort);
if ((slot < 0 || slot >= machine->ram_slots) &&
slot != PC_DIMM_UNASSIGNED_SLOT) {
error_setg(&local_err, "invalid slot number, valid range is [0-%"
PRIu64 "]", machine->ram_slots - 1);
error_setg(&local_err, "invalid slot number %d, valid range is [0-%"
PRIu64 "]", slot, machine->ram_slots - 1);
goto out;
}

Expand Down Expand Up @@ -218,7 +218,8 @@ static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)

static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
{
return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, &error_abort);
return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP,
&error_abort);
}

static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,
Expand Down
1 change: 1 addition & 0 deletions hw/scsi/esp-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ static void esp_pci_io_write(void *opaque, hwaddr addr,
addr &= ~3;
size = 4;
}
g_assert(size >= 4);

if (addr < 0x40) {
/* SCSI core reg */
Expand Down
4 changes: 0 additions & 4 deletions hw/timer/exynos4210_mct.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,6 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,

case L0_TCNTB: case L1_TCNTB:
lt_i = GET_L_TIMER_IDX(offset);
index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);

/*
* TCNTB is updated to internal register only after CNT expired.
Expand Down Expand Up @@ -1396,7 +1395,6 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,

case L0_ICNTB: case L1_ICNTB:
lt_i = GET_L_TIMER_IDX(offset);
index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);

s->l_timer[lt_i].reg.wstat |= L_WSTAT_ICNTB_WRITE;
s->l_timer[lt_i].reg.cnt[L_REG_CNT_ICNTB] = value &
Expand Down Expand Up @@ -1438,8 +1436,6 @@ static void exynos4210_mct_write(void *opaque, hwaddr offset,

case L0_FRCNTB: case L1_FRCNTB:
lt_i = GET_L_TIMER_IDX(offset);
index = GET_L_TIMER_CNT_REG_IDX(offset, lt_i);

DPRINTF("local timer[%d] FRCNTB write %llx\n", lt_i, value);

s->l_timer[lt_i].reg.wstat |= L_WSTAT_FRCCNTB_WRITE;
Expand Down
1 change: 1 addition & 0 deletions hw/timer/pxa2xx_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n)
static const int counters[8] = { 0, 0, 0, 0, 4, 4, 6, 6 };
int counter;

assert(n < ARRAY_SIZE(counters));
if (s->tm4[n].control & (1 << 7))
counter = n;
else
Expand Down
1 change: 0 additions & 1 deletion hw/timer/stm32f2xx_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ static void stm32f2xx_timer_write(void *opaque, hwaddr offset,
case TIM_PSC:
timer_val = stm32f2xx_ns_to_ticks(s, now) - s->tick_offset;
s->tim_psc = value & 0xFFFF;
value = timer_val;
break;
case TIM_CNT:
timer_val = value;
Expand Down
4 changes: 3 additions & 1 deletion include/hw/elf_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,9 @@ static int glue(load_elf, SZ)(const char *name, int fd,
*highaddr = (uint64_t)(elf_sword)high;
ret = total_size;
fail:
g_mapped_file_unref(mapped_file);
if (mapped_file) {
g_mapped_file_unref(mapped_file);
}
g_free(phdr);
return ret;
}
2 changes: 1 addition & 1 deletion include/qemu/osdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void qemu_anon_ram_free(void *ptr, size_t size);
#define HAVE_CHARDEV_SERIAL 1
#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) \
|| defined(__GLIBC__)
|| defined(__GLIBC__) || defined(__APPLE__)
#define HAVE_CHARDEV_SERIAL 1
#endif

Expand Down
4 changes: 1 addition & 3 deletions migration/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -2134,9 +2134,7 @@ int ram_postcopy_send_discard_bitmap(MigrationState *ms)
}
trace_ram_postcopy_send_discard_bitmap();

ret = postcopy_each_ram_send_discard(ms);

return ret;
return postcopy_each_ram_send_discard(ms);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions ui/gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1650,8 +1650,7 @@ static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
G_CALLBACK(gd_menu_switch_vc), s);
gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), vc->menu_item);

group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
return group;
return gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(vc->menu_item));
}

#if defined(CONFIG_VTE)
Expand Down
Loading

0 comments on commit a2261b2

Please sign in to comment.