Commit cdef24c9cd38ae236065409c4a6289f165639e55
Committed by
Tony Luck
1 parent
5302ac5019
Exists in
master
and in
39 other branches
[IA64] aliasing-test: fix gcc warnings on non-ia64
Eliminate all build warnings. OK, these build warnings are from a build on x86_64. When I build on ia64, I don't see warnings. Now builds cleanly on ia64 and x86_64. Documentation/ia64/aliasing-test.c: In function 'map_mem': Documentation/ia64/aliasing-test.c:39: warning: implicit declaration of function 'ioctl' Documentation/ia64/aliasing-test.c: In function 'scan_rom': Documentation/ia64/aliasing-test.c:183: warning: format '%ld' expects type 'long int', but argument 4 has type 'int' Documentation/ia64/aliasing-test.c: At top level: Documentation/ia64/aliasing-test.c:208: warning: function declaration isn't a prototype Documentation/ia64/aliasing-test.c: In function 'main': Documentation/ia64/aliasing-test.c:259: warning: control reaches end of non-void function Documentation/ia64/aliasing-test.c: In function 'scan_rom': Documentation/ia64/aliasing-test.c:152: warning: 'rc' may be used uninitialized in this function Documentation/ia64/aliasing-test.c: In function 'scan_tree': Documentation/ia64/aliasing-test.c:68: warning: 'rc' may be used uninitialized in this function Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Acked-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Tony Luck <tony.luck@intel.com>
Showing 1 changed file with 9 additions and 6 deletions Side-by-side Diff
Documentation/ia64/aliasing-test.c
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <fcntl.h> |
17 | 17 | #include <fnmatch.h> |
18 | 18 | #include <string.h> |
19 | +#include <sys/ioctl.h> | |
19 | 20 | #include <sys/mman.h> |
20 | 21 | #include <sys/stat.h> |
21 | 22 | #include <unistd.h> |
... | ... | @@ -65,7 +66,7 @@ |
65 | 66 | { |
66 | 67 | struct dirent **namelist; |
67 | 68 | char *name, *path2; |
68 | - int i, n, r, rc, result = 0; | |
69 | + int i, n, r, rc = 0, result = 0; | |
69 | 70 | struct stat buf; |
70 | 71 | |
71 | 72 | n = scandir(path, &namelist, 0, alphasort); |
... | ... | @@ -113,7 +114,7 @@ |
113 | 114 | free(namelist[i]); |
114 | 115 | } |
115 | 116 | free(namelist); |
116 | - return rc; | |
117 | + return result; | |
117 | 118 | } |
118 | 119 | |
119 | 120 | char buf[1024]; |
... | ... | @@ -149,7 +150,7 @@ |
149 | 150 | { |
150 | 151 | struct dirent **namelist; |
151 | 152 | char *name, *path2; |
152 | - int i, n, r, rc, result = 0; | |
153 | + int i, n, r, rc = 0, result = 0; | |
153 | 154 | struct stat buf; |
154 | 155 | |
155 | 156 | n = scandir(path, &namelist, 0, alphasort); |
... | ... | @@ -180,7 +181,7 @@ |
180 | 181 | * important thing is that no MCA happened. |
181 | 182 | */ |
182 | 183 | if (rc > 0) |
183 | - fprintf(stderr, "PASS: %s read %ld bytes\n", path2, rc); | |
184 | + fprintf(stderr, "PASS: %s read %d bytes\n", path2, rc); | |
184 | 185 | else { |
185 | 186 | fprintf(stderr, "PASS: %s not readable\n", path2); |
186 | 187 | return rc; |
187 | 188 | |
... | ... | @@ -201,10 +202,10 @@ |
201 | 202 | free(namelist[i]); |
202 | 203 | } |
203 | 204 | free(namelist); |
204 | - return rc; | |
205 | + return result; | |
205 | 206 | } |
206 | 207 | |
207 | -int main() | |
208 | +int main(void) | |
208 | 209 | { |
209 | 210 | int rc; |
210 | 211 | |
... | ... | @@ -256,5 +257,7 @@ |
256 | 257 | scan_tree("/proc/bus/pci", "??.?", 0xA0000, 0x20000, 0); |
257 | 258 | scan_tree("/proc/bus/pci", "??.?", 0xC0000, 0x40000, 1); |
258 | 259 | scan_tree("/proc/bus/pci", "??.?", 0, 1024*1024, 0); |
260 | + | |
261 | + return rc; | |
259 | 262 | } |