linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: perf_event: Remove redundant initialization of variable ret
@ 2021-11-26 22:31 Colin Ian King
  2021-11-27 19:21 ` Atish Patra
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2021-11-26 22:31 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-perf-users,
	linux-riscv
  Cc: kernel-janitors, linux-kernel

The variable ret is being initialized with a value that is never
read, it is being updated later on. The assignment is redundant and
can be removed. Clean up the incorrectly indented following
declaration of variable code and move to the same line as the
declaration of variable ret.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 arch/riscv/kernel/perf_event.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/perf_event.c b/arch/riscv/kernel/perf_event.c
index c835f0362d94..cf3e2ac9bbb2 100644
--- a/arch/riscv/kernel/perf_event.c
+++ b/arch/riscv/kernel/perf_event.c
@@ -156,8 +156,7 @@ static int riscv_map_cache_decode(u64 config, unsigned int *type,
 static int riscv_map_cache_event(u64 config)
 {
 	unsigned int type, op, result;
-	int err = -ENOENT;
-		int code;
+	int err, code;
 
 	err = riscv_map_cache_decode(config, &type, &op, &result);
 	if (!riscv_pmu->cache_events || err)
-- 
2.33.1


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

* Re: [PATCH] riscv: perf_event: Remove redundant initialization of variable ret
  2021-11-26 22:31 [PATCH] riscv: perf_event: Remove redundant initialization of variable ret Colin Ian King
@ 2021-11-27 19:21 ` Atish Patra
  0 siblings, 0 replies; 2+ messages in thread
From: Atish Patra @ 2021-11-27 19:21 UTC (permalink / raw)
  To: colin.i.king
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Paul Walmsley, Palmer Dabbelt, Albert Ou, linux-perf-users,
	linux-riscv, kernel-janitors, linux-kernel@vger.kernel.org List

On Fri, Nov 26, 2021 at 2:31 PM Colin Ian King
<colin.i.king@googlemail.com> wrote:
>
> The variable ret is being initialized with a value that is never
> read, it is being updated later on. The assignment is redundant and
> can be removed. Clean up the incorrectly indented following
> declaration of variable code and move to the same line as the
> declaration of variable ret.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  arch/riscv/kernel/perf_event.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>

This file will be removed in favor of a platform driver that has more
rich support for perf.
https://lkml.org/lkml/2021/10/25/1427

> diff --git a/arch/riscv/kernel/perf_event.c b/arch/riscv/kernel/perf_event.c
> index c835f0362d94..cf3e2ac9bbb2 100644
> --- a/arch/riscv/kernel/perf_event.c
> +++ b/arch/riscv/kernel/perf_event.c
> @@ -156,8 +156,7 @@ static int riscv_map_cache_decode(u64 config, unsigned int *type,
>  static int riscv_map_cache_event(u64 config)
>  {
>         unsigned int type, op, result;
> -       int err = -ENOENT;
> -               int code;
> +       int err, code;
>
>         err = riscv_map_cache_decode(config, &type, &op, &result);
>         if (!riscv_pmu->cache_events || err)
> --
> 2.33.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



-- 
Regards,
Atish

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

end of thread, other threads:[~2021-11-27 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26 22:31 [PATCH] riscv: perf_event: Remove redundant initialization of variable ret Colin Ian King
2021-11-27 19:21 ` Atish Patra

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