* [PATCH v3 0/9] misc: Trivial static code analyzer fixes
@ 2020-04-22 13:31 Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 1/9] block: Avoid dead assignment Philippe Mathieu-Daudé
` (10 more replies)
0 siblings, 11 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Michael Tokarev, Philippe Mathieu-Daudé,
Laurent Vivier
Fix trivial warnings reported by the Clang static code analyzer.
Only patch #2 'blockdev: Remove dead assignment' misses review.
The official Clang static code analyzer documentation is on:
https://clang-analyzer.llvm.org/
On Fedora I simply used it as:
$ sudo dnf install clang-analyzer
$ ../configure
$ scan-build make
Since v2:
- Based on lvivier/trivial-patches-for-5.1
- Removed dup patches from Kuhn Chenqun
Since v1:
- Addressed Markus/Zoltan/Aleksandar review comments
Philippe Mathieu-Daudé (9):
block: Avoid dead assignment
blockdev: Remove dead assignment
hw/i2c/pm_smbus: Remove dead assignment
hw/input/adb-kbd: Remove dead assignment
hw/ide/sii3112: Remove dead assignment
hw/isa/i82378: Remove dead assignment
hw/gpio/aspeed_gpio: Remove dead assignment
hw/timer/stm32f2xx_timer: Remove dead assignment
hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
block.c | 2 +-
blockdev.c | 2 +-
hw/gpio/aspeed_gpio.c | 2 +-
hw/i2c/pm_smbus.c | 1 -
hw/ide/sii3112.c | 5 +++--
hw/input/adb-kbd.c | 6 +-----
hw/isa/i82378.c | 8 ++++----
hw/timer/pxa2xx_timer.c | 1 +
hw/timer/stm32f2xx_timer.c | 1 -
9 files changed, 12 insertions(+), 16 deletions(-)
--
2.21.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 1/9] block: Avoid dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-23 18:11 ` Max Reitz
2020-04-22 13:31 ` [PATCH v3 2/9] blockdev: Remove " Philippe Mathieu-Daudé
` (9 subsequent siblings)
10 siblings, 1 reply; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, open list:Block layer core, qemu-trivial,
Markus Armbruster, Max Reitz, Alistair Francis,
Philippe Mathieu-Daudé
Fix warning reported by Clang static code analyzer:
block.c:3167:5: warning: Value stored to 'ret' is never read
ret = bdrv_fill_options(&options, filename, &flags, &local_err);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: 462f5bcf6
Reported-by: Clang Static Analyzer
Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 2e3905c99e..27e7e0e3ab 100644
--- a/block.c
+++ b/block.c
@@ -3171,7 +3171,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;
}
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 2/9] blockdev: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 1/9] block: Avoid dead assignment Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-23 18:11 ` Max Reitz
2020-04-22 13:31 ` [PATCH v3 3/9] hw/i2c/pm_smbus: " Philippe Mathieu-Daudé
` (8 subsequent siblings)
10 siblings, 1 reply; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, open list:Block layer core, qemu-trivial,
Markus Armbruster, Max Reitz, Philippe Mathieu-Daudé
Fix warning reported by Clang static code analyzer:
CC blockdev.o
blockdev.c:2744:5: warning: Value stored to 'ret' is never read
ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
blockdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blockdev.c b/blockdev.c
index fa8630cb41..6effd5afaa 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -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, errp);
+ blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
bdrv_drained_end(bs);
out:
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 3/9] hw/i2c/pm_smbus: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 1/9] block: Avoid dead assignment Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 2/9] blockdev: Remove " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 4/9] hw/input/adb-kbd: " Philippe Mathieu-Daudé
` (7 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Alistair Francis, Paolo Bonzini,
Philippe Mathieu-Daudé,
Michael S. Tsirkin
Fix warning reported by Clang static code analyzer:
CC hw/i2c/pm_smbus.o
hw/i2c/pm_smbus.c:187:17: warning: Value stored to 'ret' is never read
ret = 0;
^ ~
Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/i2c/pm_smbus.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index 36994ff585..4728540c37 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -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;
}
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 4/9] hw/input/adb-kbd: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 3/9] hw/i2c/pm_smbus: " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 5/9] hw/ide/sii3112: " Philippe Mathieu-Daudé
` (6 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Mark Cave-Ayland, open list:Old World g3beige,
Philippe Mathieu-Daudé,
David Gibson
Since commit 5a1f49718 the 'olen' variable is not really
used. Remove it to fix a warning reported by Clang static
code analyzer:
CC hw/input/adb-kbd.o
hw/input/adb-kbd.c:200:5: warning: Value stored to 'olen' is never read
olen = 0;
^ ~
Fixes: 5a1f49718 (adb: add support for QKeyCode)
Reported-by: Clang Static Analyzer
Suggested-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/input/adb-kbd.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/hw/input/adb-kbd.c b/hw/input/adb-kbd.c
index 0ba8207589..a6d5c9b7c9 100644
--- a/hw/input/adb-kbd.c
+++ b/hw/input/adb-kbd.c
@@ -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;
}
@@ -216,7 +214,6 @@ 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;
@@ -224,10 +221,9 @@ static int adb_kbd_poll(ADBDevice *d, uint8_t *obuf)
* 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,
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 5/9] hw/ide/sii3112: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 4/9] hw/input/adb-kbd: " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 6/9] hw/isa/i82378: " Philippe Mathieu-Daudé
` (5 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: open list:IDE, qemu-trivial, Philippe Mathieu-Daudé,
open list:sam460ex, John Snow
Fix warning reported by Clang static code analyzer:
CC hw/ide/sii3112.o
hw/ide/sii3112.c:204:9: warning: Value stored to 'val' is never read
val = 0;
^ ~
Fixes: a9dd6604
Reported-by: Clang Static Analyzer
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: John Snow <jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/ide/sii3112.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index d69079c3d9..94d2b57f95 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -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:
@@ -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;
@@ -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;
}
}
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 6/9] hw/isa/i82378: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 5/9] hw/ide/sii3112: " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 7/9] hw/gpio/aspeed_gpio: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, Alistair Francis, open list:PReP,
Philippe Mathieu-Daudé,
Hervé Poussineau
Rename the unique variable assigned as 'pit' which better
represents what it holds, to fix a warning reported by the
Clang static code analyzer:
CC hw/isa/i82378.o
hw/isa/i82378.c:108:5: warning: Value stored to 'isa' is never read
isa = isa_create_simple(isabus, "i82374");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/isa/i82378.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index dcb6b479ea..d9e6c7fa00 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -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,
@@ -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)
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 7/9] hw/gpio/aspeed_gpio: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 6/9] hw/isa/i82378: " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 8/9] hw/timer/stm32f2xx_timer: " Philippe Mathieu-Daudé
` (3 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-trivial, Andrew Jeffery,
open list:ASPEED BMCs, Joel Stanley, Philippe Mathieu-Daudé,
Cédric Le Goater
Fix warning reported by Clang static code analyzer:
hw/gpio/aspeed_gpio.c:717:18: warning: Value stored to 'g_idx' during its initialization is never read
int set_idx, g_idx = *group_idx;
^~~~~ ~~~~~~~~~~
Reported-by: Clang Static Analyzer
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/gpio/aspeed_gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/gpio/aspeed_gpio.c b/hw/gpio/aspeed_gpio.c
index 41e11ea9b0..bd19db31f4 100644
--- a/hw/gpio/aspeed_gpio.c
+++ b/hw/gpio/aspeed_gpio.c
@@ -714,7 +714,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];
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 8/9] hw/timer/stm32f2xx_timer: Remove dead assignment
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 7/9] hw/gpio/aspeed_gpio: " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 9/9] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Philippe Mathieu-Daudé
` (2 subsequent siblings)
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-trivial, Alistair Francis,
open list:STM32F205, Alistair Francis,
Philippe Mathieu-Daudé
Fix warning reported by Clang static code analyzer:
CC hw/timer/stm32f2xx_timer.o
hw/timer/stm32f2xx_timer.c:225:9: warning: Value stored to 'value' is never read
value = timer_val;
^ ~~~~~~~~~
Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/timer/stm32f2xx_timer.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/timer/stm32f2xx_timer.c b/hw/timer/stm32f2xx_timer.c
index 06ec8a02c2..ba8694dcd3 100644
--- a/hw/timer/stm32f2xx_timer.c
+++ b/hw/timer/stm32f2xx_timer.c
@@ -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;
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 9/9] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 8/9] hw/timer/stm32f2xx_timer: " Philippe Mathieu-Daudé
@ 2020-04-22 13:31 ` Philippe Mathieu-Daudé
2020-05-04 8:55 ` [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
2020-05-04 10:04 ` Laurent Vivier
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-22 13:31 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, qemu-trivial, open list:PXA2XX, Alistair Francis,
Philippe Mathieu-Daudé
pxa2xx_timer_tick4() takes an opaque pointer, then calls
pxa2xx_timer_update4(), so the static analyzer can not
verify that the 'n < 8':
425 static void pxa2xx_timer_tick4(void *opaque)
426 {
427 PXA2xxTimer4 *t = (PXA2xxTimer4 *) opaque;
428 PXA2xxTimerInfo *i = (PXA2xxTimerInfo *) t->tm.info;
429
430 pxa2xx_timer_tick(&t->tm);
433 if (t->control & (1 << 6))
434 pxa2xx_timer_update4(i, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), t->tm.num - 4);
135 static void pxa2xx_timer_update4(void *opaque, uint64_t now_qemu, int n)
136 {
137 PXA2xxTimerInfo *s = (PXA2xxTimerInfo *) opaque;
140 static const int counters[8] = { 0, 0, 0, 0, 4, 4, 6, 6 };
142
143 if (s->tm4[n].control & (1 << 7))
144 counter = n;
145 else
146 counter = counters[n];
Add an assert() to give the static analyzer a hint, this fixes a
warning reported by Clang static code analyzer:
CC hw/timer/pxa2xx_timer.o
hw/timer/pxa2xx_timer.c:146:17: warning: Assigned value is garbage or undefined
counter = counters[n];
^ ~~~~~~~~~~~
Reported-by: Clang Static Analyzer
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/timer/pxa2xx_timer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c
index cd172cc1e9..944c165889 100644
--- a/hw/timer/pxa2xx_timer.c
+++ b/hw/timer/pxa2xx_timer.c
@@ -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
--
2.21.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 2/9] blockdev: Remove dead assignment
2020-04-22 13:31 ` [PATCH v3 2/9] blockdev: Remove " Philippe Mathieu-Daudé
@ 2020-04-23 18:11 ` Max Reitz
0 siblings, 0 replies; 14+ messages in thread
From: Max Reitz @ 2020-04-23 18:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-trivial, Kevin Wolf, Markus Armbruster, open list:Block layer core
[-- Attachment #1.1: Type: text/plain, Size: 579 bytes --]
On 22.04.20 15:31, Philippe Mathieu-Daudé wrote:
> Fix warning reported by Clang static code analyzer:
>
> CC blockdev.o
> blockdev.c:2744:5: warning: Value stored to 'ret' is never read
> ret = blk_truncate(blk, size, false, PREALLOC_MODE_OFF, errp);
> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Reported-by: Clang Static Analyzer
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> blockdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 1/9] block: Avoid dead assignment
2020-04-22 13:31 ` [PATCH v3 1/9] block: Avoid dead assignment Philippe Mathieu-Daudé
@ 2020-04-23 18:11 ` Max Reitz
0 siblings, 0 replies; 14+ messages in thread
From: Max Reitz @ 2020-04-23 18:11 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-trivial, Kevin Wolf, Alistair Francis, Markus Armbruster,
open list:Block layer core
[-- Attachment #1.1: Type: text/plain, Size: 686 bytes --]
On 22.04.20 15:31, Philippe Mathieu-Daudé wrote:
> Fix warning reported by Clang static code analyzer:
>
> block.c:3167:5: warning: Value stored to 'ret' is never read
> ret = bdrv_fill_options(&options, filename, &flags, &local_err);
> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fixes: 462f5bcf6
> Reported-by: Clang Static Analyzer
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> block.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Max Reitz <mreitz@redhat.com>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 0/9] misc: Trivial static code analyzer fixes
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2020-04-22 13:31 ` [PATCH v3 9/9] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Philippe Mathieu-Daudé
@ 2020-05-04 8:55 ` Philippe Mathieu-Daudé
2020-05-04 10:04 ` Laurent Vivier
10 siblings, 0 replies; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-04 8:55 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Laurent Vivier
On 4/22/20 3:31 PM, Philippe Mathieu-Daudé wrote:
> Fix trivial warnings reported by the Clang static code analyzer.
>
> Only patch #2 'blockdev: Remove dead assignment' misses review.
Thanks to Max this series is now fully reviewed, so... ping?
>
> The official Clang static code analyzer documentation is on:
> https://clang-analyzer.llvm.org/
>
> On Fedora I simply used it as:
>
> $ sudo dnf install clang-analyzer
> $ ../configure
> $ scan-build make
>
> Since v2:
> - Based on lvivier/trivial-patches-for-5.1
> - Removed dup patches from Kuhn Chenqun
> Since v1:
> - Addressed Markus/Zoltan/Aleksandar review comments
>
> Philippe Mathieu-Daudé (9):
> block: Avoid dead assignment
> blockdev: Remove dead assignment
> hw/i2c/pm_smbus: Remove dead assignment
> hw/input/adb-kbd: Remove dead assignment
> hw/ide/sii3112: Remove dead assignment
> hw/isa/i82378: Remove dead assignment
> hw/gpio/aspeed_gpio: Remove dead assignment
> hw/timer/stm32f2xx_timer: Remove dead assignment
> hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
>
> block.c | 2 +-
> blockdev.c | 2 +-
> hw/gpio/aspeed_gpio.c | 2 +-
> hw/i2c/pm_smbus.c | 1 -
> hw/ide/sii3112.c | 5 +++--
> hw/input/adb-kbd.c | 6 +-----
> hw/isa/i82378.c | 8 ++++----
> hw/timer/pxa2xx_timer.c | 1 +
> hw/timer/stm32f2xx_timer.c | 1 -
> 9 files changed, 12 insertions(+), 16 deletions(-)
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 0/9] misc: Trivial static code analyzer fixes
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2020-05-04 8:55 ` [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
@ 2020-05-04 10:04 ` Laurent Vivier
10 siblings, 0 replies; 14+ messages in thread
From: Laurent Vivier @ 2020-05-04 10:04 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: qemu-trivial, Michael Tokarev
Le 22/04/2020 à 15:31, Philippe Mathieu-Daudé a écrit :
> Fix trivial warnings reported by the Clang static code analyzer.
>
> Only patch #2 'blockdev: Remove dead assignment' misses review.
>
> The official Clang static code analyzer documentation is on:
> https://clang-analyzer.llvm.org/
>
> On Fedora I simply used it as:
>
> $ sudo dnf install clang-analyzer
> $ ../configure
> $ scan-build make
>
> Since v2:
> - Based on lvivier/trivial-patches-for-5.1
> - Removed dup patches from Kuhn Chenqun
> Since v1:
> - Addressed Markus/Zoltan/Aleksandar review comments
>
> Philippe Mathieu-Daudé (9):
> block: Avoid dead assignment
> blockdev: Remove dead assignment
> hw/i2c/pm_smbus: Remove dead assignment
> hw/input/adb-kbd: Remove dead assignment
> hw/ide/sii3112: Remove dead assignment
> hw/isa/i82378: Remove dead assignment
> hw/gpio/aspeed_gpio: Remove dead assignment
> hw/timer/stm32f2xx_timer: Remove dead assignment
> hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning
>
> block.c | 2 +-
> blockdev.c | 2 +-
> hw/gpio/aspeed_gpio.c | 2 +-
> hw/i2c/pm_smbus.c | 1 -
> hw/ide/sii3112.c | 5 +++--
> hw/input/adb-kbd.c | 6 +-----
> hw/isa/i82378.c | 8 ++++----
> hw/timer/pxa2xx_timer.c | 1 +
> hw/timer/stm32f2xx_timer.c | 1 -
> 9 files changed, 12 insertions(+), 16 deletions(-)
>
Applied to my trivial-patches branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2020-05-04 10:06 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 13:31 [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 1/9] block: Avoid dead assignment Philippe Mathieu-Daudé
2020-04-23 18:11 ` Max Reitz
2020-04-22 13:31 ` [PATCH v3 2/9] blockdev: Remove " Philippe Mathieu-Daudé
2020-04-23 18:11 ` Max Reitz
2020-04-22 13:31 ` [PATCH v3 3/9] hw/i2c/pm_smbus: " Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 4/9] hw/input/adb-kbd: " Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 5/9] hw/ide/sii3112: " Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 6/9] hw/isa/i82378: " Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 7/9] hw/gpio/aspeed_gpio: " Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 8/9] hw/timer/stm32f2xx_timer: " Philippe Mathieu-Daudé
2020-04-22 13:31 ` [PATCH v3 9/9] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning Philippe Mathieu-Daudé
2020-05-04 8:55 ` [PATCH v3 0/9] misc: Trivial static code analyzer fixes Philippe Mathieu-Daudé
2020-05-04 10:04 ` Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.