2021-03-05 09:42:03

by Xu Wang

[permalink] [raw]
Subject: [PATCH] tracing/tools: Remove unneeded semicolon

fix semicolon.cocci warning:
tools/tracing/latency/latency-collector.c:1021:2-3: Unneeded semicolon

Signed-off-by: Xu Wang <[email protected]>
---
tools/tracing/latency/latency-collector.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/latency/latency-collector.c
index b69de9263ee6..129fb00b70c2 100644
--- a/tools/tracing/latency/latency-collector.c
+++ b/tools/tracing/latency/latency-collector.c
@@ -1018,7 +1018,7 @@ static long go_to_sleep(const struct entry *req)
cond_timedwait(&printstate.cond, &printstate.mutex, &future);
if (time_has_passed(&future))
break;
- };
+ }

if (printstate_has_new_req_arrived(req))
delay = -1;
--
2.17.1


2021-03-05 10:51:03

by Viktor Rosendahl

[permalink] [raw]
Subject: Re: [PATCH] tracing/tools: Remove unneeded semicolon

On Fri, 2021-03-05 at 09:40 +0000, Xu Wang wrote:
> fix semicolon.cocci warning:
> tools/tracing/latency/latency-collector.c:1021:2-3: Unneeded semicolon
>
> Signed-off-by: Xu Wang <[email protected]>
> ---
> tools/tracing/latency/latency-collector.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/tracing/latency/latency-collector.c
> b/tools/tracing/latency/latency-collector.c
> index b69de9263ee6..129fb00b70c2 100644
> --- a/tools/tracing/latency/latency-collector.c
> +++ b/tools/tracing/latency/latency-collector.c
> @@ -1018,7 +1018,7 @@ static long go_to_sleep(const struct entry *req)
> cond_timedwait(&printstate.cond, &printstate.mutex, &future);
> if (time_has_passed(&future))
> break;
> - };
> + }
>
> if (printstate_has_new_req_arrived(req))
> delay = -1;

Looks good but I would suggest to fix also the other instances of superfluous
semicolons with the same patch.

There seems to be a lonely semicolon on line 1944, i.e this code:

if (value < 0) {
warnx("TIME must be >= 0\n");
show_usage();
;
}

In that case the lonely semicolon should be replaced with "exit(0);"

best regards,

Viktor

2021-03-05 14:23:26

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] tracing/tools: Remove unneeded semicolon

On Fri, 5 Mar 2021 10:42:08 +0000
<[email protected]> wrote:

> Looks good but I would suggest to fix also the other instances of superfluous
> semicolons with the same patch.
>
> There seems to be a lonely semicolon on line 1944, i.e this code:
>
> if (value < 0) {
> warnx("TIME must be >= 0\n");
> show_usage();
> ;
> }
>
> In that case the lonely semicolon should be replaced with "exit(0);"

Agreed. I'll wait for v2 of the patch.

Thanks,

-- Steve