Skip to contentSkip to conversation

hw: Remove unneeded variable assignment

PATCH Applied Philippe Mathieu-Daudé 6 participants 12 messages Feb 15, 2020 – Feb 18, 2020 Block layer

lore
Share & tools
lore
#6 lore raw

PATCH 2/3 hw/display/qxl: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read

      uint32_t orig_io_port = io_port;
               ^~~~~~~~~~~~   ~~~~~~~
Reported-by Clang Static Analyzer
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/qxl.c +1 -1
index 64884da708..21a43a1d5e 100644
@@ -1631,7 +1631,7 @@ static void ioport_write(void *opaque, hwaddr addr,
     PCIQXLDevice *d = opaque;
     uint32_t io_port = addr;
     qxl_async_io async = QXL_SYNC;
-    uint32_t orig_io_port = io_port;
+    uint32_t orig_io_port;
 
     if (d->guest_bug && io_port != QXL_IO_RESET) {
         return;
Signature · 1 line
2.21.1
#9 lore raw

PATCH 3/3 hw/block/pflash_cfi02: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

CC hw/block/pflash_cfi02.o
hw/block/pflash_cfi02.c:311:5: warning: Value stored to 'ret' is never read

      ret = -1;
      ^     ~~
Reported-by Clang Static Analyzer
---
 hw/block/pflash_cfi02.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/pflash_cfi02.c +0 -1
index 7c4744c020..12f18d401a 100644
@@ -308,7 +308,6 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width)
     hwaddr boff;
     uint64_t ret;
 
-    ret = -1;
     /* Lazy reset to ROMD mode after a certain amount of read accesses */
     if (!pfl->rom_mode && pfl->wcycle == 0 &&
         ++pfl->read_counter > PFLASH_LAZY_ROMD_THRESHOLD) {
Signature · 1 line
2.21.1
#0 lore raw

cover hw: Remove unneeded variable assignment

Fix few warnings reported by Clang static code analyzer.

Philippe Mathieu-Daudé (3):
block/qcow2-bitmap: Remove unneeded variable assignment hw/display/qxl: Remove unneeded variable assignment hw/block/pflash_cfi02: Remove unneeded variable assignment

 block/qcow2-bitmap.c    | 1 -
 hw/block/pflash_cfi02.c | 1 -
 hw/display/qxl.c        | 2 +-
 3 files changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
2.21.1
#1 lore raw

PATCH 1/3 block/qcow2-bitmap: Remove unneeded variable assignment

Fix warning reported by Clang static code analyzer:

CC block/qcow2-bitmap.o
block/qcow2-bitmap.c:650:5: warning: Value stored to 'ret' is never read

      ret = -EINVAL;
      ^     ~~~~~~~
Reported-by Clang Static Analyzer
---
 block/qcow2-bitmap.c | 1 -
 1 file changed, 1 deletion(-)
block/qcow2-bitmap.c +0 -1
index d41f5d049b..8cccc2c9f3 100644
@@ -647,7 +647,6 @@ static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset,
     return bm_list;
 
 broken_dir:
-    ret = -EINVAL;
     error_setg(errp, "Broken bitmap directory");
 
 fail:
Signature · 1 line
2.21.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] block/qcow2-bitmap: Remove unneeded variable assignment

Quoted 4 lines · Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

CC block/qcow2-bitmap.o
block/qcow2-bitmap.c:650:5: warning: Value stored to 'ret' is never read

Quoted 8 lines
      ret = -EINVAL;
      ^     ~~~~~~~
Reported-by Clang Static Analyzer
---
 block/qcow2-bitmap.c | 1 -
 1 file changed, 1 deletion(-)

r~

Reviewed-by on v1 2/3
#7 lore raw

Re: [PATCH 2/3] hw/display/qxl: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé
Quoted 11 lines · Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read

      uint32_t orig_io_port = io_port;
               ^~~~~~~~~~~~   ~~~~~~~
Reported-by Clang Static Analyzer
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

r~

Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] hw/block/pflash_cfi02: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

CC hw/block/pflash_cfi02.o
hw/block/pflash_cfi02.c:311:5: warning: Value stored to 'ret' is never read

Quoted 8 lines
      ret = -1;
      ^     ~~
Reported-by Clang Static Analyzer
---
 hw/block/pflash_cfi02.c | 1 -
 1 file changed, 1 deletion(-)

r~

Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH 1/3] block/qcow2-bitmap: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

CC block/qcow2-bitmap.o
block/qcow2-bitmap.c:650:5: warning: Value stored to 'ret' is never read

Quoted 9 lines
     ret = -EINVAL;
     ^     ~~~~~~~
Reported-by Clang Static Analyzer

---
block/qcow2-bitmap.c | 1 -

1 file changed, 1 deletion(-)

Unused since its introduction in 88ddffae8fc1e30cc907c2dbb989b7eba9e62319

Jano

Reviewed-by on v1 1/3
#4 lore raw

Re: [PATCH 1/3] block/qcow2-bitmap: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé
Quoted 19 lines · Philippe Mathieu-Daudé

Fix warning reported by Clang static code analyzer:

CC block/qcow2-bitmap.o
block/qcow2-bitmap.c:650:5: warning: Value stored to 'ret' is never read

       ret = -EINVAL;
       ^     ~~~~~~~
Reported-by Clang Static Analyzer
---
  block/qcow2-bitmap.c | 1 -
  1 file changed, 1 deletion(-)
block/qcow2-bitmap.c +0 -0
index d41f5d049b..8cccc2c9f3 100644

block/qcow2-bitmap.c static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset, · line 652

Quoted 7 lines
block/qcow2-bitmap.c +0 -1
@@ -647,7 +647,6 @@ static Qcow2BitmapList *bitmap_list_load(BlockDriverState *bs, uint64_t offset,
      return bm_list;
 
  broken_dir:
-    ret = -EINVAL;
      error_setg(errp, "Broken bitmap directory");
 
  fail:
Signature · 2 lines
Best regards,
Vladimir
#5 lore raw

Re: [PATCH 1/3] block/qcow2-bitmap: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé

Am 15.02.2020 um 17:15 hat Philippe Mathieu-Daudé geschrieben:

Quoted 9 lines

Fix warning reported by Clang static code analyzer:

CC block/qcow2-bitmap.o
block/qcow2-bitmap.c:650:5: warning: Value stored to 'ret' is never read

      ret = -EINVAL;
      ^     ~~~~~~~
Reported-by Clang Static Analyzer

This isn't hw/, so I'm taking it through my tree. Thanks, applied to the block branch.

Kevin

#8 lore raw

Re: [PATCH 2/3] hw/display/qxl: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé

Le 15/02/2020 à 17:15, Philippe Mathieu-Daudé a écrit :

Quoted 18 lines

Fix warning reported by Clang static code analyzer:

hw/display/qxl.c:1634:14: warning: Value stored to 'orig_io_port' during its initialization is never read

      uint32_t orig_io_port = io_port;
               ^~~~~~~~~~~~   ~~~~~~~
Reported-by Clang Static Analyzer
---
 hw/display/qxl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/qxl.c +0 -0
index 64884da708..21a43a1d5e 100644

hw/display/qxl.c static void ioport_write(void *opaque, hwaddr addr, · line 1637

Quoted 8 lines
hw/display/qxl.c +1 -1
@@ -1631,7 +1631,7 @@ static void ioport_write(void *opaque, hwaddr addr,
     PCIQXLDevice *d = opaque;
     uint32_t io_port = addr;
     qxl_async_io async = QXL_SYNC;
-    uint32_t orig_io_port = io_port;
+    uint32_t orig_io_port;
 
     if (d->guest_bug && io_port != QXL_IO_RESET) {
         return;

Applied to my trivial-patches branch.

Thanks,
Laurent

#11 lore raw

Re: [PATCH 3/3] hw/block/pflash_cfi02: Remove unneeded variable assignment

In reply to Philippe Mathieu-Daudé

Le 15/02/2020 à 17:15, Philippe Mathieu-Daudé a écrit :

Quoted 19 lines

Fix warning reported by Clang static code analyzer:

CC hw/block/pflash_cfi02.o
hw/block/pflash_cfi02.c:311:5: warning: Value stored to 'ret' is never read

      ret = -1;
      ^     ~~
Reported-by Clang Static Analyzer
---
 hw/block/pflash_cfi02.c | 1 -
 1 file changed, 1 deletion(-)
hw/block/pflash_cfi02.c +0 -0
index 7c4744c020..12f18d401a 100644

hw/block/pflash_cfi02.c static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width) · line 313

Quoted 7 lines
hw/block/pflash_cfi02.c +0 -1
@@ -308,7 +308,6 @@ static uint64_t pflash_read(void *opaque, hwaddr offset, unsigned int width)
     hwaddr boff;
     uint64_t ret;
 
-    ret = -1;
     /* Lazy reset to ROMD mode after a certain amount of read accesses */
     if (!pfl->rom_mode && pfl->wcycle == 0 &&
         ++pfl->read_counter > PFLASH_LAZY_ROMD_THRESHOLD) {

Applied to my trivial-patches branch.

Thanks,
Laurent