浏览代码

scripts/kallsyms: Enable error messages while hush up unnecessary warnings

As no error was handled, we wouldn't be able to know when an error does
occur. The fix preserves error messages while it doesn't let unnecessary
compiling warnings show up.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Jean Sacren 14 年之前
父节点
当前提交
ef894870c6
共有 1 个文件被更改,包括 2 次插入6 次删除
  1. 2 6
      scripts/kallsyms.c

+ 2 - 6
scripts/kallsyms.c

@@ -107,12 +107,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
 
 
 	rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
 	rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
 	if (rc != 3) {
 	if (rc != 3) {
-		if (rc != EOF) {
-			/* skip line. sym is used as dummy to
-			 * shut of "warn_unused_result" warning.
-			 */
-			sym = fgets(str, 500, in);
-		}
+		if (rc != EOF && fgets(str, 500, in) == NULL)
+			fprintf(stderr, "Read error or end of file.\n");
 		return -1;
 		return -1;
 	}
 	}