Skip to contentSkip to conversation

tracing: remove redundant assignment to pointer 'event'

PATCH In review Colin King 2 participants 3 messages Jun 17, 2019

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 tracing: remove redundant assignment to pointer 'event'

From: Colin Ian King <[email protected]>

The value assigned to pointer 'event' is never read and hence it is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 kernel/trace/trace_events_hist.c | 1 -
 1 file changed, 1 deletion(-)
kernel/trace/trace_events_hist.c +0 -1
index ca6b0dff60c5..0013b43d8b4d 100644
@@ -1294,7 +1294,6 @@ static int __create_synth_event(int argc, const char *name, const char **argv)
 	event = alloc_synth_event(name, n_fields, fields);
 	if (IS_ERR(event)) {
 		ret = PTR_ERR(event);
-		event = NULL;
 		goto err;
 	}
 	ret = register_synth_event(event);
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 16 lines · On Mon, 17 Jun 2019 13:37:22 +0100 Colin King <[email protected]> wrote:

From: Colin Ian King <[email protected]>

The value assigned to pointer 'event' is never read and hence it is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 kernel/trace/trace_events_hist.c | 1 -
 1 file changed, 1 deletion(-)
kernel/trace/trace_events_hist.c +0 -0
index ca6b0dff60c5..0013b43d8b4d 100644

kernel/trace/trace_events_hist.c static int __create_synth_event(int argc, const char *name, const char **argv) · line 1297

Quoted 4 lines
kernel/trace/trace_events_hist.c +0 -1
@@ -1294,7 +1294,6 @@ static int __create_synth_event(int argc, const char *name, const char **argv)
 	event = alloc_synth_event(name, n_fields, fields);
 	if (IS_ERR(event)) {
 		ret = PTR_ERR(event);
-		event = NULL;

This is one of those cases where I rather not touch it.

Yeah, it may not be read, but assigning event to NULL isn't dangerous here. And if we change the code to expect event to be NULL or something real, it is better to keep this.

-- Steve

Quoted 3 lines
kernel/trace/trace_events_hist.c +0 -0
 		goto err;
 	}
 	ret = register_synth_event(event);
#2 lore raw
Quoted 26 lines · Steven Rostedt
Quoted 16 lines · On Mon, 17 Jun 2019 13:37:22 +0100 Colin King <[email protected]> wrote:

From: Colin Ian King <[email protected]>

The value assigned to pointer 'event' is never read and hence it is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 kernel/trace/trace_events_hist.c | 1 -
 1 file changed, 1 deletion(-)
kernel/trace/trace_events_hist.c +0 -0
index ca6b0dff60c5..0013b43d8b4d 100644

kernel/trace/trace_events_hist.c static int __create_synth_event(int argc, const char *name, const char **argv) · line 1297

Quoted 4 lines
kernel/trace/trace_events_hist.c +0 -1
@@ -1294,7 +1294,6 @@ static int __create_synth_event(int argc, const char *name, const char **argv)
 	event = alloc_synth_event(name, n_fields, fields);
 	if (IS_ERR(event)) {
 		ret = PTR_ERR(event);
-		event = NULL;

This is one of those cases where I rather not touch it.

Quoted 3 lines

Yeah, it may not be read, but assigning event to NULL isn't dangerous here. And if we change the code to expect event to be NULL or something real, it is better to keep this.

OK, makes sense.

Quoted 9 lines

-- Steve

Quoted 3 lines
kernel/trace/trace_events_hist.c +0 -0
 		goto err;
 	}
 	ret = register_synth_event(event);