[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH-for-5.0 05/11] hw/ide/sii3112: Remove dead assignment
From: |
Aleksandar Markovic |
Subject: |
Re: [PATCH-for-5.0 05/11] hw/ide/sii3112: Remove dead assignment |
Date: |
Sat, 21 Mar 2020 14:39:56 +0100 |
On Saturday, March 21, 2020, Philippe Mathieu-Daudé <address@hidden> wrote:
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;
^ ~
Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/ide/sii3112.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/ide/sii3112.c b/hw/ide/sii3112.c
index 06605d7af2..36f1905ddb 100644
--- a/hw/ide/sii3112.c
+++ b/hw/ide/sii3112.c
@@ -125,7 +125,7 @@ static uint64_t sii3112_reg_read(void *opaque, hwaddr addr,
val = (uint32_t)d->regs[1].sien << 16;
break;
default:
- val = 0;
+ break;
There is another function in the same file, having a similar switch statement. There is no warning for that second tunction, since "val" is its parameter, not a local varioble, like is the case here. This means that the proposed change introduces inconsistency between two functions, therefore it is better to remove the initialization of "val" to 0, than to remove this line in "default" section.
Regards,
Aleksandar
}
trace_sii3112_read(size, addr, val);
return val;
--
2.21.1
- Re: [PATCH-for-5.0 01/11] block: Remove dead assignment, (continued)
- [PATCH-for-5.0 02/11] blockdev: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
- [PATCH-for-5.0 03/11] hw/i2c/pm_smbus: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
- [PATCH-for-5.0 04/11] hw/input/adb-kbd: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
- [PATCH-for-5.0 05/11] hw/ide/sii3112: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
- Re: [PATCH-for-5.0 05/11] hw/ide/sii3112: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
- Re: [PATCH-for-5.0 05/11] hw/ide/sii3112: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
[PATCH-for-5.0 06/11] hw/isa/i82378: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
[PATCH-for-5.0 07/11] hw/gpio/aspeed_gpio: Remove dead assignment, Philippe Mathieu-Daudé, 2020/03/21
[PATCH-for-5.0 08/11] hw/timer/exynos4210_mct: Remove dead assignments, Philippe Mathieu-Daudé, 2020/03/21