qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] contrib/plugins/cache.c: Remove redundant check of l2_access
@ 2024-07-25 16:48 Peter Maydell
  2024-07-25 19:55 ` Philippe Mathieu-Daudé
  2024-07-25 20:30 ` Alex Bennée
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2024-07-25 16:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Pierrick Bouvier

In append_stats_line(), we have an expression
   l2_access ? l2_miss_rate : 0.0
But this is inside an if (l2_access && l2_misses) { ... } block,
so Coverity points out that the false part of the ?: is dead code.

Remove the unnecessary test.

Resolves: Coverity CID 1522458
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 contrib/plugins/cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index c5c8ac75a9c..512ef6776b7 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -558,7 +558,7 @@ static void append_stats_line(GString *line,
                                "  %-12" PRIu64 " %-11" PRIu64 " %10.4lf%%",
                                l2_access,
                                l2_misses,
-                               l2_access ? l2_miss_rate : 0.0);
+                               l2_miss_rate);
     }
 
     g_string_append(line, "\n");
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] contrib/plugins/cache.c: Remove redundant check of l2_access
  2024-07-25 16:48 [PATCH] contrib/plugins/cache.c: Remove redundant check of l2_access Peter Maydell
@ 2024-07-25 19:55 ` Philippe Mathieu-Daudé
  2024-07-25 20:30 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-25 19:55 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: Alex Bennée, Pierrick Bouvier

On 25/7/24 18:48, Peter Maydell wrote:
> In append_stats_line(), we have an expression
>     l2_access ? l2_miss_rate : 0.0
> But this is inside an if (l2_access && l2_misses) { ... } block,
> so Coverity points out that the false part of the ?: is dead code.
> 
> Remove the unnecessary test.
> 
> Resolves: Coverity CID 1522458
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   contrib/plugins/cache.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] contrib/plugins/cache.c: Remove redundant check of l2_access
  2024-07-25 16:48 [PATCH] contrib/plugins/cache.c: Remove redundant check of l2_access Peter Maydell
  2024-07-25 19:55 ` Philippe Mathieu-Daudé
@ 2024-07-25 20:30 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2024-07-25 20:30 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, Pierrick Bouvier

Peter Maydell <peter.maydell@linaro.org> writes:

> In append_stats_line(), we have an expression
>    l2_access ? l2_miss_rate : 0.0
> But this is inside an if (l2_access && l2_misses) { ... } block,
> so Coverity points out that the false part of the ?: is dead code.
>
> Remove the unnecessary test.
>
> Resolves: Coverity CID 1522458
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Queued to maintainer/for-9.1, thanks.

> ---
>  contrib/plugins/cache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
> index c5c8ac75a9c..512ef6776b7 100644
> --- a/contrib/plugins/cache.c
> +++ b/contrib/plugins/cache.c
> @@ -558,7 +558,7 @@ static void append_stats_line(GString *line,
>                                 "  %-12" PRIu64 " %-11" PRIu64 " %10.4lf%%",
>                                 l2_access,
>                                 l2_misses,
> -                               l2_access ? l2_miss_rate : 0.0);
> +                               l2_miss_rate);
>      }
>  
>      g_string_append(line, "\n");

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-25 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 16:48 [PATCH] contrib/plugins/cache.c: Remove redundant check of l2_access Peter Maydell
2024-07-25 19:55 ` Philippe Mathieu-Daudé
2024-07-25 20:30 ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).