diff mbox series

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

Message ID 20200215161557.4077-4-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series hw: Remove unneeded variable assignment | expand

Commit Message

Philippe Mathieu-Daudé Feb. 15, 2020, 4:15 p.m. UTC
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
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/block/pflash_cfi02.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Richard Henderson Feb. 16, 2020, 2:14 a.m. UTC | #1
On 2/15/20 8:15 AM, Philippe Mathieu-Daudé wrote:
> 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
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/block/pflash_cfi02.c | 1 -
>  1 file changed, 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~
Laurent Vivier Feb. 18, 2020, 7:16 p.m. UTC | #2
Le 15/02/2020 à 17:15, Philippe Mathieu-Daudé a écrit :
> 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
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/block/pflash_cfi02.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
> index 7c4744c020..12f18d401a 100644
> --- a/hw/block/pflash_cfi02.c
> +++ b/hw/block/pflash_cfi02.c
> @@ -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
diff mbox series

Patch

diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index 7c4744c020..12f18d401a 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -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) {