[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 02/19] display/blizzard: use extract16() for fix clang analyzer
From: |
Laurent Vivier |
Subject: |
[PULL v2 02/19] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32() |
Date: |
Mon, 4 May 2020 17:59:39 +0200 |
From: Chen Qun <address@hidden>
Clang static code analyzer show warning:
hw/display/blizzard.c:940:9: warning: Value stored to 'data' is never read
data >>= 5;
^ ~
Reported-by: Euler Robot <address@hidden>
Signed-off-by: Chen Qun <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>
---
hw/display/blizzard.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/display/blizzard.c b/hw/display/blizzard.c
index 359e399c2a0b..105241577de1 100644
--- a/hw/display/blizzard.c
+++ b/hw/display/blizzard.c
@@ -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"
@@ -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);
}
}
--
2.26.2
- [PULL v2 00/19] Trivial branch for 5.1 patches, Laurent Vivier, 2020/05/04
- [PULL v2 05/19] hw/mem/pc-dimm: Print slot number on error at pc_dimm_pre_plug(), Laurent Vivier, 2020/05/04
- [PULL v2 06/19] hw/mem/pc-dimm: Fix line over 80 characters warning, Laurent Vivier, 2020/05/04
- [PULL v2 04/19] MAINTAINERS: Mark the LatticeMico32 target as orphan, Laurent Vivier, 2020/05/04
- [PULL v2 02/19] display/blizzard: use extract16() for fix clang analyzer warning in blizzard_draw_line16_32(),
Laurent Vivier <=
- [PULL v2 07/19] elf_ops: Don't try to g_mapped_file_unref(NULL), Laurent Vivier, 2020/05/04
- [PULL v2 08/19] MAINTAINERS: Update Keith Busch's email address, Laurent Vivier, 2020/05/04
- [PULL v2 03/19] timer/exynos4210_mct: Remove redundant statement in exynos4210_mct_write(), Laurent Vivier, 2020/05/04
- [PULL v2 12/19] blockdev: Remove dead assignment, Laurent Vivier, 2020/05/04
- [PULL v2 01/19] scsi/esp-pci: add g_assert() for fix clang analyzer warning in esp_pci_io_write(), Laurent Vivier, 2020/05/04
- [PULL v2 10/19] Compress lines for immediate return, Laurent Vivier, 2020/05/04
- [PULL v2 09/19] chardev: Add macOS to list of OSes that support -chardev serial, Laurent Vivier, 2020/05/04
- [PULL v2 13/19] hw/i2c/pm_smbus: Remove dead assignment, Laurent Vivier, 2020/05/04
- [PULL v2 17/19] hw/gpio/aspeed_gpio: Remove dead assignment, Laurent Vivier, 2020/05/04
- [PULL v2 19/19] hw/timer/pxa2xx_timer: Add assertion to silent static analyzer warning, Laurent Vivier, 2020/05/04