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

Chen Qun posted 10 patches 5 years, 5 months ago
Maintainers: Shannon Zhao <shannon.zhaosl@gmail.com>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Igor Mammedov <imammedo@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Peter Maydell <peter.maydell@linaro.org>
[PATCH v3 09/10] hw/intc: fix default registers value in exynos4210_combiner_read()
Posted by Chen Qun 5 years, 5 months ago
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'.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
---
Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>

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(-)

diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
index b8561e4180..59dd27fb16 100644
--- a/hw/intc/exynos4210_combiner.c
+++ b/hw/intc/exynos4210_combiner.c
@@ -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;
 }
-- 
2.23.0


Re: [PATCH v3 09/10] hw/intc: fix default registers value in exynos4210_combiner_read()
Posted by Peter Maydell 5 years, 5 months ago
On Thu, 27 Aug 2020 at 12:04, Chen Qun <kuhn.chenqun@huawei.com> wrote:
>
> 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'.
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

Re: [PATCH v3 09/10] hw/intc: fix default registers value in exynos4210_combiner_read()
Posted by Laurent Vivier 5 years, 5 months ago
Le 27/08/2020 à 13:03, Chen Qun a écrit :
> 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'.
> 
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> 
> 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(-)
> 
> diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
> index b8561e4180..59dd27fb16 100644
> --- a/hw/intc/exynos4210_combiner.c
> +++ b/hw/intc/exynos4210_combiner.c
> @@ -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