Skip to contentSkip to conversation

perf diff: fix error return value in __cmd_diff()

PATCH Applied Zhen Lei 4 participants 7 messages Nov 24, 2020 – Nov 28, 2020 perf events

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 perf diff: fix error return value in __cmd_diff()

An appropriate return value should be set on the failed path.

---
 tools/perf/builtin-diff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-diff.c +3 -1
index 584e2e1a3793..cefc71506409 100644
@@ -1222,8 +1222,10 @@ static int __cmd_diff(void)
 		if (compute == COMPUTE_STREAM) {
 			d->evlist_streams = evlist__create_streams(
 						d->session->evlist, 5);
-			if (!d->evlist_streams)
+			if (!d->evlist_streams) {
+				ret = -ENOMEM;
 				goto out_delete;
+			}
 		}
 	}
 
Signature · 1 line
2.26.0.106.g9fadedd
#1 lore raw

Hi everybody:
Can any one review it?

Quoted 25 lines · Zhen Lei

An appropriate return value should be set on the failed path.

---
 tools/perf/builtin-diff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-diff.c +3 -1
index 584e2e1a3793..cefc71506409 100644
@@ -1222,8 +1222,10 @@ static int __cmd_diff(void)
 		if (compute == COMPUTE_STREAM) {
 			d->evlist_streams = evlist__create_streams(
 						d->session->evlist, 5);
-			if (!d->evlist_streams)
+			if (!d->evlist_streams) {
+				ret = -ENOMEM;
 				goto out_delete;
+			}
 		}
 	}
 
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Zhen Lei

Hello,

Quoted 5 lines · Zhen Lei

An appropriate return value should be set on the failed path.

Thanks,
Namhyung

Quoted 24 lines
---
 tools/perf/builtin-diff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-diff.c +3 -2
index 584e2e1a3793..cefc71506409 100644
@@ -1222,8 +1222,10 @@ static int __cmd_diff(void)
                if (compute == COMPUTE_STREAM) {
                        d->evlist_streams = evlist__create_streams(
                                                d->session->evlist, 5);
-                       if (!d->evlist_streams)
+                       if (!d->evlist_streams) {
+                               ret = -ENOMEM;
                                goto out_delete;
+                       }
                }
        }
 
--

2.26.0.106.g9fadedd

maintainer Applied
#3 lore raw

Em Fri, Nov 27, 2020 at 10:35:37PM +0900, Namhyung Kim escreveu:

Quoted 10 lines

Hello,

Quoted 5 lines · Zhen Lei

An appropriate return value should be set on the failed path.

Thanks, applied.

- Arnaldo

Quoted 27 lines

Thanks,
Namhyung

Quoted 24 lines
---
 tools/perf/builtin-diff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-diff.c +3 -2
index 584e2e1a3793..cefc71506409 100644
@@ -1222,8 +1222,10 @@ static int __cmd_diff(void)
                if (compute == COMPUTE_STREAM) {
                        d->evlist_streams = evlist__create_streams(
                                                d->session->evlist, 5);
-                       if (!d->evlist_streams)
+                       if (!d->evlist_streams) {
+                               ret = -ENOMEM;
                                goto out_delete;
+                       }
                }
        }
 
--

2.26.0.106.g9fadedd

Signature · 1 line
- Arnaldo
#4 lore raw

Em Fri, Nov 27, 2020 at 02:22:02PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Em Fri, Nov 27, 2020 at 10:35:37PM +0900, Namhyung Kim escreveu:

Quoted 8 lines · Zhen Lei
Quoted 5 lines

An appropriate return value should be set on the failed path.

Thanks, applied.

I also added this:

Cc Jin Yao <[email protected]>
Fixes 2a09a84c720b436a ("perf diff: Support hot streams comparison")

Please add the fixes line and CC the author of the patch introducing the bug next time,

Thanks

- Arnaldo

#5 lore raw
Quoted 13 lines · Arnaldo Carvalho de Melo

Em Fri, Nov 27, 2020 at 02:22:02PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Em Fri, Nov 27, 2020 at 10:35:37PM +0900, Namhyung Kim escreveu:

Quoted 8 lines · Zhen Lei
Quoted 5 lines

An appropriate return value should be set on the failed path.

Thanks, applied.

Quoted 7 lines

I also added this:

Cc Jin Yao <[email protected]>
Fixes 2a09a84c720b436a ("perf diff: Support hot streams comparison")

Please add the fixes line and CC the author of the patch introducing the bug next time,

Okay, I'll do that next time. Thanks for the heads-up.

Quoted 7 lines

Thanks

- Arnaldo

.

Acked-by on v1 1/1
#6 lore raw
In reply to Zhen Lei
Quoted 4 lines · Zhen Lei

An appropriate return value should be set on the failed path.

thanks,
jirka

Quoted 24 lines
---
 tools/perf/builtin-diff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/builtin-diff.c +3 -1
index 584e2e1a3793..cefc71506409 100644
@@ -1222,8 +1222,10 @@ static int __cmd_diff(void)
 		if (compute == COMPUTE_STREAM) {
 			d->evlist_streams = evlist__create_streams(
 						d->session->evlist, 5);
-			if (!d->evlist_streams)
+			if (!d->evlist_streams) {
+				ret = -ENOMEM;
 				goto out_delete;
+			}
 		}
 	}
 
Signature · 1 line
2.26.0.106.g9fadedd