Skip to contentSkip to conversation

Fix compiler warning in ftrace.c

PATCH In review GuoWen Li 2 participants 5 messages Jun 1, 2011 – Jun 8, 2011

Subsystems (2)
lore
Share & tools
lore

GuoWen Li

author
#0 lore raw

PATCH 1/1 Fix compiler warning in ftrace.c

kernel/trace/ftrace.c: In function ‘ftrace_regex_write.clone.15’:
kernel/trace/ftrace.c:2743:6: warning: ‘ret’ may be used uninitialized in this function

Signed-off-by GuoWen Li
---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +0 -0
index 1ee417f..204b3eb 100644
@@ -2740,7 +2740,7 @@ static int ftrace_process_regex(struct ftrace_hash 

*hash,

 {
        char *func, *command, *next = buff;
        struct ftrace_func_command *p;

- int ret;
+ int ret = -EINVAL;

        func = strsep(&next, ":");
maintainer
#1 lore raw
Quoted 3 lines · GuoWen Li

kernel/trace/ftrace.c: In function ‘ftrace_regex_write.clone.15’:
kernel/trace/ftrace.c:2743:6: warning: ‘ret’ may be used uninitialized in this function

Thanks, but this isn't just a fix of a warning, it fixes an actual bug.

-- Steve

Quoted 19 lines
Signed-off-by GuoWen Li
---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +1 -1
index 1ee417f..204b3eb 100644
@@ -2740,7 +2740,7 @@ static int ftrace_process_regex(struct ftrace_hash 
 *hash,
 {
        char *func, *command, *next = buff;
        struct ftrace_func_command *p;
-       int ret;
+       int ret = -EINVAL;
 
        func = strsep(&next, ":");
maintainer
#2 lore raw
In reply to GuoWen Li

Couple of things:

Quoted 5 lines · GuoWen Li

kernel/trace/ftrace.c: In function ‘ftrace_regex_write.clone.15’:
kernel/trace/ftrace.c:2743:6: warning: ‘ret’ may be used uninitialized in this function

Signed-off-by GuoWen Li

Please add your mail address to your SOB. (I'll fix it)

Quoted 9 lines
---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +0 -0
index 1ee417f..204b3eb 100644

kernel/trace/ftrace.c static int ftrace_process_regex(struct ftrace_hash · line 2744

Quoted 6 lines
kernel/trace/ftrace.c +1 -1
@@ -2740,7 +2740,7 @@ static int ftrace_process_regex(struct ftrace_hash 
 *hash,
 {
        char *func, *command, *next = buff;
        struct ftrace_func_command *p;
-       int ret;
+       int ret = -EINVAL;

This patch has horrible white space issues. (I fixed it)

-- Steve

Quoted 2 lines
kernel/trace/ftrace.c +0 -0
        func = strsep(&next, ":");
author
#3 lore raw

Thank you for pointing them out, i will be careful next time. :)

----- Original Message -----
From: "Steven Rostedt" <[email protected]>
To: "GuoWen Li" <[email protected]>
Cc: <[email protected]>
Sent: Friday, June 03, 2011 10:50 AM
Subject: Re: [PATCH] Fix compiler warning in ftrace.c

Quoted 37 lines

Couple of things:

Quoted 5 lines · GuoWen Li

kernel/trace/ftrace.c: In function ‘ftrace_regex_write.clone.15’:
kernel/trace/ftrace.c:2743:6: warning: ‘ret’ may be used uninitialized in this function

Signed-off-by GuoWen Li

Please add your mail address to your SOB. (I'll fix it)

Quoted 9 lines
---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +0 -0
index 1ee417f..204b3eb 100644

kernel/trace/ftrace.c static int ftrace_process_regex(struct ftrace_hash · line 2744

Quoted 6 lines
kernel/trace/ftrace.c +1 -1
@@ -2740,7 +2740,7 @@ static int ftrace_process_regex(struct ftrace_hash 
 *hash,
 {
        char *func, *command, *next = buff;
        struct ftrace_func_command *p;
-       int ret;
+       int ret = -EINVAL;

This patch has horrible white space issues. (I fixed it)

-- Steve

kernel/trace/ftrace.c static int ftrace_process_regex(struct ftrace_hash · line 2745

Quoted 2 lines
kernel/trace/ftrace.c +0 -0
        func = strsep(&next, ":");

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

#4 lore raw

[tip:perf/urgent] ftrace: Fix possible undefined return code

In reply to GuoWen Li
Commit-ID:  0aff1c0cef13b34c17e81a502336fad738151c37
Gitweb:     http://git.kernel.org/tip/0aff1c0cef13b34c17e81a502336fad738151c37
Author:     GuoWen Li <[email protected]>
AuthorDate: Wed, 1 Jun 2011 19:18:47 +0800
Committer:  Steven Rostedt <[email protected]>
CommitDate: Mon, 6 Jun 2011 22:34:25 -0400

ftrace: Fix possible undefined return code

kernel/trace/ftrace.c: In function 'ftrace_regex_write.clone.15':
kernel/trace/ftrace.c:2743:6: warning: 'ret' may be used uninitialized in this function

---
 kernel/trace/ftrace.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +1 -1
index 1ee417f..204b3eb 100644
@@ -2740,7 +2740,7 @@ static int ftrace_process_regex(struct ftrace_hash *hash,
 {
 	char *func, *command, *next = buff;
 	struct ftrace_func_command *p;
-	int ret;
+	int ret = -EINVAL;
 
 	func = strsep(&next, ":");