See the following in the read_file function.
*value = read_shares_file(filepath);
if (*value == -1)
        return -1;
Since the return value of read_shares_file and the variable value are
unsigned int, it is impossible that *value == -1.

Signed-off-by: Yuan Sun <sunyu...@huawei.com>
---
 testcases/kernel/controllers/libcontrollers/libcontrollers.c | 6 ++++--
 testcases/kernel/controllers/libcontrollers/libcontrollers.h | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.c 
b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
index b01e1b8..80a90b9 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.c
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.c
@@ -115,11 +115,14 @@ int read_file(char *filepath, int action, unsigned int 
*value)
 {
        int num_line = 0;
        FILE *fp;
+       int tmp;
        switch (action) {
        case GET_SHARES:
-               *value = read_shares_file(filepath);
+               tmp = read_shares_file(filepath);
                if (*value == -1)
                        return -1;
+               else
+                       *value = (unsigned int)tmp;
                break;
 
        case GET_TASKS:
@@ -159,7 +162,6 @@ inline int error_function(char *msg1, char *msg2)
  * the given pointer location. Returns 0 if success
  */
 
-unsigned
 int read_shares_file(char *filepath)
 {
        FILE *fp;
diff --git a/testcases/kernel/controllers/libcontrollers/libcontrollers.h 
b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
index 4001555..78a7fed 100644
--- a/testcases/kernel/controllers/libcontrollers/libcontrollers.h
+++ b/testcases/kernel/controllers/libcontrollers/libcontrollers.h
@@ -72,7 +72,7 @@ enum{
 
 inline int error_function(char *msg1, char *msg2);
 
-unsigned int read_shares_file (char *filepath);
+int read_shares_file(char *filepath);
 
 int read_file(char *filepath, int action, unsigned int *value);
 
-- 
1.9.1


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to