Skip to contentSkip to conversation

trivial patchs for static code analyzer fixes

PATCH Applied Chen Qun 4 participants 23 messages Aug 27, 2020 – Sep 1, 2020 Arm Samsung Exynos

lore
Share & tools
lore

Chen Qun

author
#0 lore raw

v3 cover trivial patchs for static code analyzer fixes

Since v2:
- Patch1: Addressed Li Qiang review comment.
- Patch2: Addressed Peter Maydell and Li Qiang review comment.
- Patch3:Delete memleak commit message, and Addressed Peter Maydell review comment.
- Patch4: Addressed Peter Maydell review comment.
- Patch6: Addressed Li Qiang review comment.
- Patch7: Addressed Stefan Hajnoczi and Li Qiang review comment.
- Patch8: Addressed Markus Armbruster review comment.
- Patch9: Change default return value in exynos4210_combiner_read().

Chen Qun (10):
hw/arm/virt-acpi-build:Remove dead assignment in build_madt() hw/arm/omap1:Remove redundant statement in omap_clkdsp_read() target/arm/translate-a64:Remove dead assignment in
handle_scalar_simd_shli()
target/arm/translate-a64:Remove redundant statement in

    disas_simd_two_reg_misc_fp16()

hw/virtio/vhost-user:Remove dead assignment in scrub_shadow_regions() hw/net/virtio-net:Remove redundant statement in
virtio_net_rsc_tcp_ctrl_check()
vfio/platform: Remove dead assignment in vfio_intp_interrupt() usb/bus: Remove dead assignment in usb_get_fw_dev_path() hw/intc: fix default registers value in exynos4210_combiner_read() hw/display/vga:Remove redundant statement in vga_draw_graphic()

 hw/arm/omap1.c                | 1 -
 hw/arm/virt-acpi-build.c      | 3 +--
 hw/display/vga.c              | 1 -
 hw/intc/exynos4210_combiner.c | 1 -
 hw/net/virtio-net.c           | 1 -
 hw/usb/bus.c                  | 4 ++--
 hw/vfio/platform.c            | 2 +-
 hw/virtio/vhost-user.c        | 2 +-
 target/arm/translate-a64.c    | 7 ++-----
 9 files changed, 7 insertions(+), 15 deletions(-)
Signature · 1 line
2.23.0
author
#1 lore raw

PATCH v3 1/10 hw/arm/virt-acpi-build:Remove dead assignment in build_madt()

Clang static code analyzer show warning:
hw/arm/virt-acpi-build.c:641:5: warning: Value stored to 'madt' is never read

    madt = acpi_data_push(table_data, sizeof *madt);
    ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
Cc: Shannon Zhao <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: [email protected]

---
 hw/arm/virt-acpi-build.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +1 -2
index 91f0df7b13..f830f9b779 100644
@@ -633,12 +633,11 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     int madt_start = table_data->len;
     const MemMapEntry *memmap = vms->memmap;
     const int *irqmap = vms->irqmap;
-    AcpiMultipleApicTable *madt;
     AcpiMadtGenericDistributor *gicd;
     AcpiMadtGenericMsiFrame *gic_msi;
     int i;
 
-    madt = acpi_data_push(table_data, sizeof *madt);
+    acpi_data_push(table_data, sizeof(AcpiMultipleApicTable));
 
     gicd = acpi_data_push(table_data, sizeof *gicd);
     gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR;
Signature · 1 line
2.23.0
#2 lore raw

Re: [PATCH v3 01/10] hw/arm/virt-acpi-build:Remove dead assignment in build_madt()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 28 lines

Clang static code analyzer show warning:
hw/arm/virt-acpi-build.c:641:5: warning: Value stored to 'madt' is never read

    madt = acpi_data_push(table_data, sizeof *madt);
    ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
Cc: Shannon Zhao <[email protected]>
Cc: Peter Maydell <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: [email protected]

---
 hw/arm/virt-acpi-build.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/arm/virt-acpi-build.c +0 -0
index 91f0df7b13..f830f9b779 100644
@@ -633,12 +633,11 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
     int madt_start = table_data->len;
     const MemMapEntry *memmap = vms->memmap;
     const int *irqmap = vms->irqmap;

hw/arm/virt-acpi-build.c build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) · line 643

Quoted 10 lines
hw/arm/virt-acpi-build.c +1 -2
-    AcpiMultipleApicTable *madt;
     AcpiMadtGenericDistributor *gicd;
     AcpiMadtGenericMsiFrame *gic_msi;
     int i;
 
-    madt = acpi_data_push(table_data, sizeof *madt);
+    acpi_data_push(table_data, sizeof(AcpiMultipleApicTable));
 
     gicd = acpi_data_push(table_data, sizeof *gicd);
     gicd->type = ACPI_APIC_GENERIC_DISTRIBUTOR;

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#3 lore raw

PATCH v3 2/10 hw/arm/omap1:Remove redundant statement in omap_clkdsp_read()

In reply to Chen Qun

Clang static code analyzer show warning:
hw/arm/omap1.c:1760:15: warning: Value stored to 'cpu' during its initialization is never read

    CPUState *cpu = CPU(s->cpu);
              ^~~   ~~~~~~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

---
 hw/arm/omap1.c | 1 -
 1 file changed, 1 deletion(-)
hw/arm/omap1.c +0 -1
index 6ba0df6b6d..02c0f66431 100644
@@ -1774,7 +1774,6 @@ static uint64_t omap_clkdsp_read(void *opaque, hwaddr addr,
         return s->clkm.dsp_rstct2;
 
     case 0x18:	/* DSP_SYSST */
-        cpu = CPU(s->cpu);
         return (s->clkm.clocking_scheme << 11) | s->clkm.cold_start |
                 (cpu->halted << 6);      /* Quite useless... */
     }
Signature · 1 line
2.23.0
#4 lore raw

Re: [PATCH v3 02/10] hw/arm/omap1:Remove redundant statement in omap_clkdsp_read()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 23 lines

Clang static code analyzer show warning:
hw/arm/omap1.c:1760:15: warning: Value stored to 'cpu' during its initialization is never read

    CPUState *cpu = CPU(s->cpu);
              ^~~   ~~~~~~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

---
 hw/arm/omap1.c | 1 -
 1 file changed, 1 deletion(-)
hw/arm/omap1.c +0 -0
index 6ba0df6b6d..02c0f66431 100644

hw/arm/omap1.c static uint64_t omap_clkdsp_read(void *opaque, hwaddr addr, · line 1779

Quoted 7 lines
hw/arm/omap1.c +0 -1
@@ -1774,7 +1774,6 @@ static uint64_t omap_clkdsp_read(void *opaque, hwaddr addr,
         return s->clkm.dsp_rstct2;
 
     case 0x18:	/* DSP_SYSST */
-        cpu = CPU(s->cpu);
         return (s->clkm.clocking_scheme << 11) | s->clkm.cold_start |
                 (cpu->halted << 6);      /* Quite useless... */
     }

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#5 lore raw

PATCH v3 3/10 target/arm/translate-a64:Remove dead assignment in handle_scalar_simd_shli()

In reply to Chen Qun

Clang static code analyzer show warning:
target/arm/translate-a64.c:8635:14: warning: Value stored to 'tcg_rn' during its
initialization is never read

    TCGv_i64 tcg_rn = new_tmp_a64(s);
             ^~~~~~   ~~~~~~~~~~~~~~
target/arm/translate-a64.c:8636:14: warning: Value stored to 'tcg_rd' during its
 initialization is never read
    TCGv_i64 tcg_rd = new_tmp_a64(s);
             ^~~~~~   ~~~~~~~~~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

v2->v3:According to Peter's review, the variable 's' does not have a memleak, so deleted the description about memleak.

---
 target/arm/translate-a64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/translate-a64.c +2 -2
index 534c3ff5f3..c83bb85e4e 100644
@@ -8632,8 +8632,8 @@ static void handle_scalar_simd_shli(DisasContext *s, bool insert,
     int size = 32 - clz32(immh) - 1;
     int immhb = immh << 3 | immb;
     int shift = immhb - (8 << size);
-    TCGv_i64 tcg_rn = new_tmp_a64(s);
-    TCGv_i64 tcg_rd = new_tmp_a64(s);
+    TCGv_i64 tcg_rn;
+    TCGv_i64 tcg_rd;
 
     if (!extract32(immh, 3, 1)) {
         unallocated_encoding(s);
Signature · 1 line
2.23.0
#6 lore raw

Re: [PATCH v3 03/10] target/arm/translate-a64:Remove dead assignment in handle_scalar_simd_shli()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 29 lines

Clang static code analyzer show warning:
target/arm/translate-a64.c:8635:14: warning: Value stored to 'tcg_rn' during its
initialization is never read

    TCGv_i64 tcg_rn = new_tmp_a64(s);
             ^~~~~~   ~~~~~~~~~~~~~~
target/arm/translate-a64.c:8636:14: warning: Value stored to 'tcg_rd' during its
 initialization is never read
    TCGv_i64 tcg_rd = new_tmp_a64(s);
             ^~~~~~   ~~~~~~~~~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

v2->v3:According to Peter's review, the variable 's' does not have a memleak, so deleted the description about memleak.

---
 target/arm/translate-a64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/translate-a64.c +0 -0
index 534c3ff5f3..c83bb85e4e 100644

target/arm/translate-a64.c static void handle_scalar_simd_shli(DisasContext *s, bool insert, · line 8639

Quoted 10 lines
target/arm/translate-a64.c +2 -2
@@ -8632,8 +8632,8 @@ static void handle_scalar_simd_shli(DisasContext *s, bool insert,
     int size = 32 - clz32(immh) - 1;
     int immhb = immh << 3 | immb;
     int shift = immhb - (8 << size);
-    TCGv_i64 tcg_rn = new_tmp_a64(s);
-    TCGv_i64 tcg_rd = new_tmp_a64(s);
+    TCGv_i64 tcg_rn;
+    TCGv_i64 tcg_rd;
 
     if (!extract32(immh, 3, 1)) {
         unallocated_encoding(s);

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#7 lore raw

PATCH v3 4/10 target/arm/translate-a64:Remove redundant statement in disas_simd_two_reg_misc_fp16()

In reply to Chen Qun

Clang static code analyzer show warning:
target/arm/translate-a64.c:13007:5: warning: Value stored to 'rd' is never read

    rd = extract32(insn, 0, 5);
    ^    ~~~~~~~~~~~~~~~~~~~~~
target/arm/translate-a64.c:13008:5: warning: Value stored to 'rn' is never read
    rn = extract32(insn, 5, 5);
    ^    ~~~~~~~~~~~~~~~~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

---
 target/arm/translate-a64.c | 3 ---
 1 file changed, 3 deletions(-)
target/arm/translate-a64.c +0 -3
index c83bb85e4e..47cce160d8 100644
@@ -13016,9 +13016,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
     fpop = deposit32(opcode, 5, 1, a);
     fpop = deposit32(fpop, 6, 1, u);
 
-    rd = extract32(insn, 0, 5);
-    rn = extract32(insn, 5, 5);
-
     switch (fpop) {
     case 0x1d: /* SCVTF */
     case 0x5d: /* UCVTF */
Signature · 1 line
2.23.0
#8 lore raw

Re: [PATCH v3 04/10] target/arm/translate-a64:Remove redundant statement in disas_simd_two_reg_misc_fp16()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 24 lines

Clang static code analyzer show warning:
target/arm/translate-a64.c:13007:5: warning: Value stored to 'rd' is never read

    rd = extract32(insn, 0, 5);
    ^    ~~~~~~~~~~~~~~~~~~~~~
target/arm/translate-a64.c:13008:5: warning: Value stored to 'rn' is never read
    rn = extract32(insn, 5, 5);
    ^    ~~~~~~~~~~~~~~~~~~~~~

---
Cc: Peter Maydell <[email protected]>
Cc: [email protected]

---
 target/arm/translate-a64.c | 3 ---
 1 file changed, 3 deletions(-)
target/arm/translate-a64.c +0 -0
index c83bb85e4e..47cce160d8 100644

target/arm/translate-a64.c static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn) · line 13021

Quoted 9 lines
target/arm/translate-a64.c +0 -3
@@ -13016,9 +13016,6 @@ static void disas_simd_two_reg_misc_fp16(DisasContext *s, uint32_t insn)
     fpop = deposit32(opcode, 5, 1, a);
     fpop = deposit32(fpop, 6, 1, u);
 
-    rd = extract32(insn, 0, 5);
-    rn = extract32(insn, 5, 5);
-
     switch (fpop) {
     case 0x1d: /* SCVTF */
     case 0x5d: /* UCVTF */

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#9 lore raw

PATCH v3 5/10 hw/virtio/vhost-user:Remove dead assignment in scrub_shadow_regions()

In reply to Chen Qun

Clang static code analyzer show warning:
hw/virtio/vhost-user.c:606:9: warning: Value stored to 'mr' is never read

        mr = vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd);
        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Raphael Norwitz <[email protected]>

---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
index d7e2423762..9c5b4f7fbc 100644
@@ -603,7 +603,7 @@ static void scrub_shadow_regions(struct vhost_dev *dev,
      */
     for (i = 0; i < dev->mem->nregions; i++) {
         reg = &dev->mem->regions[i];
-        mr = vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd);
+        vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd);
         if (fd > 0) {
             ++fd_num;
         }
Signature · 1 line
2.23.0
#10 lore raw

Re: [PATCH v3 05/10] hw/virtio/vhost-user:Remove dead assignment in scrub_shadow_regions()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 21 lines

Clang static code analyzer show warning:
hw/virtio/vhost-user.c:606:9: warning: Value stored to 'mr' is never read

        mr = vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd);
        ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Raphael Norwitz <[email protected]>

---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +0 -0
index d7e2423762..9c5b4f7fbc 100644

hw/virtio/vhost-user.c static void scrub_shadow_regions(struct vhost_dev *dev, · line 609

Quoted 8 lines
hw/virtio/vhost-user.c +1 -1
@@ -603,7 +603,7 @@ static void scrub_shadow_regions(struct vhost_dev *dev,
      */
     for (i = 0; i < dev->mem->nregions; i++) {
         reg = &dev->mem->regions[i];
-        mr = vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd);
+        vhost_user_get_mr_data(reg->userspace_addr, &offset, &fd);
         if (fd > 0) {
             ++fd_num;
         }

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#11 lore raw

PATCH v3 6/10 hw/net/virtio-net:Remove redundant statement in virtio_net_rsc_tcp_ctrl_check()

In reply to Chen Qun

Clang static code analyzer show warning:
hw/net/virtio-net.c:2077:5: warning: Value stored to 'tcp_flag' is never read

    tcp_flag &= VIRTIO_NET_TCP_FLAG;
    ^           ~~~~~~~~~~~~~~~~~~~

The 'VIRTIO_NET_TCP_FLAG' is '0x3F'. The last ‘tcp_flag’ assignment statement is
the same as that of the first two statements.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Jason Wang <[email protected]>

---
 hw/net/virtio-net.c | 1 -
 1 file changed, 1 deletion(-)
hw/net/virtio-net.c +0 -1
index a1fe9e9285..cb0d27084c 100644
@@ -2075,7 +2075,6 @@ static int virtio_net_rsc_tcp_ctrl_check(VirtioNetRscChain *chain,
     tcp_flag = htons(tcp->th_offset_flags);
     tcp_hdr = (tcp_flag & VIRTIO_NET_TCP_HDR_LENGTH) >> 10;
     tcp_flag &= VIRTIO_NET_TCP_FLAG;
-    tcp_flag = htons(tcp->th_offset_flags) & 0x3F;
     if (tcp_flag & TH_SYN) {
         chain->stat.tcp_syn++;
         return RSC_BYPASS;
Signature · 1 line
2.23.0
#12 lore raw

Re: [PATCH v3 06/10] hw/net/virtio-net:Remove redundant statement in virtio_net_rsc_tcp_ctrl_check()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 25 lines

Clang static code analyzer show warning:
hw/net/virtio-net.c:2077:5: warning: Value stored to 'tcp_flag' is never read

    tcp_flag &= VIRTIO_NET_TCP_FLAG;
    ^           ~~~~~~~~~~~~~~~~~~~

The 'VIRTIO_NET_TCP_FLAG' is '0x3F'. The last ‘tcp_flag’ assignment statement is
the same as that of the first two statements.

---
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Jason Wang <[email protected]>

---
 hw/net/virtio-net.c | 1 -
 1 file changed, 1 deletion(-)
hw/net/virtio-net.c +0 -0
index a1fe9e9285..cb0d27084c 100644

hw/net/virtio-net.c static int virtio_net_rsc_tcp_ctrl_check(VirtioNetRscChain *chain, · line 2080

Quoted 7 lines
hw/net/virtio-net.c +0 -1
@@ -2075,7 +2075,6 @@ static int virtio_net_rsc_tcp_ctrl_check(VirtioNetRscChain *chain,
     tcp_flag = htons(tcp->th_offset_flags);
     tcp_hdr = (tcp_flag & VIRTIO_NET_TCP_HDR_LENGTH) >> 10;
     tcp_flag &= VIRTIO_NET_TCP_FLAG;
-    tcp_flag = htons(tcp->th_offset_flags) & 0x3F;
     if (tcp_flag & TH_SYN) {
         chain->stat.tcp_syn++;
         return RSC_BYPASS;

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#13 lore raw

PATCH v3 7/10 vfio/platform: Remove dead assignment in vfio_intp_interrupt()

In reply to Chen Qun

Clang static code analyzer show warning:
hw/vfio/platform.c:239:9: warning: Value stored to 'ret' is never read

        ret = event_notifier_test_and_clear(intp->interrupt);
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
Cc: Alex Williamson <[email protected]>
Cc: Eric Auger <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>

---
 hw/vfio/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/platform.c +1 -1
index ac2cefc9b1..869ed2c39d 100644
@@ -236,7 +236,7 @@ static void vfio_intp_interrupt(VFIOINTp *intp)
         trace_vfio_intp_interrupt_set_pending(intp->pin);
         QSIMPLEQ_INSERT_TAIL(&vdev->pending_intp_queue,
                              intp, pqnext);
-        ret = event_notifier_test_and_clear(intp->interrupt);
+        event_notifier_test_and_clear(intp->interrupt);
         return;
     }
 
Signature · 1 line
2.23.0
#14 lore raw

Re: [PATCH v3 07/10] vfio/platform: Remove dead assignment in vfio_intp_interrupt()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 24 lines

Clang static code analyzer show warning:
hw/vfio/platform.c:239:9: warning: Value stored to 'ret' is never read

        ret = event_notifier_test_and_clear(intp->interrupt);
        ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---
Cc: Alex Williamson <[email protected]>
Cc: Eric Auger <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>

---
 hw/vfio/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/platform.c +0 -0
index ac2cefc9b1..869ed2c39d 100644

hw/vfio/platform.c static void vfio_intp_interrupt(VFIOINTp *intp) · line 242

Quoted 8 lines
hw/vfio/platform.c +1 -1
@@ -236,7 +236,7 @@ static void vfio_intp_interrupt(VFIOINTp *intp)
         trace_vfio_intp_interrupt_set_pending(intp->pin);
         QSIMPLEQ_INSERT_TAIL(&vdev->pending_intp_queue,
                              intp, pqnext);
-        ret = event_notifier_test_and_clear(intp->interrupt);
+        event_notifier_test_and_clear(intp->interrupt);
         return;
     }
 

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#15 lore raw

PATCH v3 8/10 usb/bus: Remove dead assignment in usb_get_fw_dev_path()

In reply to Chen Qun

Clang static code analyzer show warning:
qemu/hw/usb/bus.c:615:13: warning: Value stored to 'pos' is never read

            pos += snprintf(fw_path + pos, fw_len - pos, "%s@%lx",

---
Cc: Gerd Hoffmann <[email protected]>
Cc: Markus Armbruster <[email protected]>

v2->v3: The format of the snprintf statement is modified(Base on Markus review).

---
 hw/usb/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/bus.c +2 -2
index b17bda3b29..2b11041451 100644
@@ -612,8 +612,8 @@ static char *usb_get_fw_dev_path(DeviceState *qdev)
             in++;
         } else {
             /* the device itself */
-            pos += snprintf(fw_path + pos, fw_len - pos, "%s@%lx",
-                            qdev_fw_name(qdev), nr);
+            snprintf(fw_path + pos, fw_len - pos, "%s@%lx",
+                     qdev_fw_name(qdev), nr);
             break;
         }
     }
Signature · 1 line
2.23.0
Reviewed-by on v3 8/10
#16 lore raw

Re: [PATCH v3 08/10] usb/bus: Remove dead assignment in usb_get_fw_dev_path()

Quoted 7 lines · Chen Qun

Clang static code analyzer show warning:
qemu/hw/usb/bus.c:615:13: warning: Value stored to 'pos' is never read

            pos += snprintf(fw_path + pos, fw_len - pos, "%s@%lx",
#17 lore raw

Re: [PATCH v3 08/10] usb/bus: Remove dead assignment in usb_get_fw_dev_path()

In reply to Chen Qun

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 22 lines

Clang static code analyzer show warning:
qemu/hw/usb/bus.c:615:13: warning: Value stored to 'pos' is never read

            pos += snprintf(fw_path + pos, fw_len - pos, "%s@%lx",

---
Cc: Gerd Hoffmann <[email protected]>
Cc: Markus Armbruster <[email protected]>

v2->v3: The format of the snprintf statement is modified(Base on Markus review).

---
 hw/usb/bus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/usb/bus.c +0 -0
index b17bda3b29..2b11041451 100644

hw/usb/bus.c static char *usb_get_fw_dev_path(DeviceState *qdev) · line 619

Quoted 10 lines
hw/usb/bus.c +2 -2
@@ -612,8 +612,8 @@ static char *usb_get_fw_dev_path(DeviceState *qdev)
             in++;
         } else {
             /* the device itself */
-            pos += snprintf(fw_path + pos, fw_len - pos, "%s@%lx",
-                            qdev_fw_name(qdev), nr);
+            snprintf(fw_path + pos, fw_len - pos, "%s@%lx",
+                     qdev_fw_name(qdev), nr);
             break;
         }
     }

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#18 lore raw

PATCH v3 9/10 hw/intc: fix default registers value in exynos4210_combiner_read()

In reply to Chen Qun

Clang static code analyzer show warning:
hw/intc/exynos4210_combiner.c:231:9: warning: Value stored to 'val' is never read

        val = s->reg_set[offset >> 2];

The default register return value should be return 'val'.

---
Cc: Igor Mitsyanko <[email protected]>
Cc: Peter Maydell <[email protected]>

v2->v3: Change default register return value from '0' to 'val = s->reg_set[offset >> 2]'.

---
 hw/intc/exynos4210_combiner.c | 1 -
 1 file changed, 1 deletion(-)
hw/intc/exynos4210_combiner.c +0 -1
index b8561e4180..59dd27fb16 100644
@@ -229,7 +229,6 @@ exynos4210_combiner_read(void *opaque, hwaddr offset, unsigned size)
                     TARGET_FMT_plx "offset\n", offset);
         }
         val = s->reg_set[offset >> 2];
-        return 0;
     }
     return val;
 }
Signature · 1 line
2.23.0
Reviewed-by on v3 9/10
#19 lore raw

Re: [PATCH v3 09/10] hw/intc: fix default registers value in exynos4210_combiner_read()

Quoted 5 lines · Chen Qun

Clang static code analyzer show warning:
hw/intc/exynos4210_combiner.c:231:9: warning: Value stored to 'val' is never read

        val = s->reg_set[offset >> 2];
Quoted 8 lines

The default register return value should be return 'val'.

---
Cc: Igor Mitsyanko <[email protected]>
Cc: Peter Maydell <[email protected]>

thanks
-- PMM

#20 lore raw

Re: [PATCH v3 09/10] hw/intc: fix default registers value in exynos4210_combiner_read()

In reply to Chen Qun

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 23 lines

Clang static code analyzer show warning:
hw/intc/exynos4210_combiner.c:231:9: warning: Value stored to 'val' is never read

        val = s->reg_set[offset >> 2];

The default register return value should be return 'val'.

---
Cc: Igor Mitsyanko <[email protected]>
Cc: Peter Maydell <[email protected]>

v2->v3: Change default register return value from '0' to 'val = s->reg_set[offset >> 2]'.

---
 hw/intc/exynos4210_combiner.c | 1 -
 1 file changed, 1 deletion(-)
hw/intc/exynos4210_combiner.c +0 -0
index b8561e4180..59dd27fb16 100644

hw/intc/exynos4210_combiner.c exynos4210_combiner_read(void *opaque, hwaddr offset, unsigned size) · line 234

Quoted 7 lines
hw/intc/exynos4210_combiner.c +0 -1
@@ -229,7 +229,6 @@ exynos4210_combiner_read(void *opaque, hwaddr offset, unsigned size)
                     TARGET_FMT_plx "offset\n", offset);
         }
         val = s->reg_set[offset >> 2];
-        return 0;
     }
     return val;
 }

Applied to my trivial-patches branch.

Thanks,
Laurent

author
#21 lore raw

PATCH v3 10/10 hw/display/vga:Remove redundant statement in vga_draw_graphic()

In reply to Chen Qun

Clang static code analyzer show warning:
hw/display/vga.c:1677:9: warning: Value stored to 'update' is never read

        update = full_update;
        ^        ~~~~~~~~~~~

---
Cc: Gerd Hoffmann <[email protected]>

---
 hw/display/vga.c | 1 -
 1 file changed, 1 deletion(-)
hw/display/vga.c +0 -1
index 061fd9ab8f..836ad50c7b 100644
@@ -1674,7 +1674,6 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
         if (!(s->cr[VGA_CRTC_MODE] & 2)) {
             addr = (addr & ~0x8000) | ((y1 & 2) << 14);
         }
-        update = full_update;
         page0 = addr & s->vbe_size_mask;
         page1 = (addr + bwidth - 1) & s->vbe_size_mask;
         if (full_update) {
Signature · 1 line
2.23.0
#22 lore raw

Re: [PATCH v3 10/10] hw/display/vga:Remove redundant statement in vga_draw_graphic()

Le 27/08/2020 à 13:03, Chen Qun a écrit :

Quoted 21 lines

Clang static code analyzer show warning:
hw/display/vga.c:1677:9: warning: Value stored to 'update' is never read

        update = full_update;
        ^        ~~~~~~~~~~~

---
Cc: Gerd Hoffmann <[email protected]>

---
 hw/display/vga.c | 1 -
 1 file changed, 1 deletion(-)
hw/display/vga.c +0 -0
index 061fd9ab8f..836ad50c7b 100644

hw/display/vga.c static void vga_draw_graphic(VGACommonState *s, int full_update) · line 1679

Quoted 7 lines
hw/display/vga.c +0 -1
@@ -1674,7 +1674,6 @@ static void vga_draw_graphic(VGACommonState *s, int full_update)
         if (!(s->cr[VGA_CRTC_MODE] & 2)) {
             addr = (addr & ~0x8000) | ((y1 & 2) << 14);
         }
-        update = full_update;
         page0 = addr & s->vbe_size_mask;
         page1 = (addr + bwidth - 1) & s->vbe_size_mask;
         if (full_update) {

Applied to my trivial-patches branch.

Thanks,
Laurent