LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ia64 aliasing-test: fix gcc warnings on non-ia64
@ 2008-01-16  0:05 Randy Dunlap
  2008-01-16 18:05 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2008-01-16  0:05 UTC (permalink / raw)
  To: lkml; +Cc: bjorn.helgaas, akpm

From: Randy Dunlap <randy.dunlap@oracle.com>

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>
---
 Documentation/ia64/aliasing-test.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

--- linux-2.6.24-rc7.orig/Documentation/ia64/aliasing-test.c
+++ linux-2.6.24-rc7/Documentation/ia64/aliasing-test.c
@@ -16,6 +16,7 @@
 #include <fcntl.h>
 #include <fnmatch.h>
 #include <string.h>
+#include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -65,7 +66,7 @@ int scan_tree(char *path, char *file, of
 {
 	struct dirent **namelist;
 	char *name, *path2;
-	int i, n, r, rc, result = 0;
+	int i, n, r, rc = 0, result = 0;
 	struct stat buf;
 
 	n = scandir(path, &namelist, 0, alphasort);
@@ -113,7 +114,7 @@ skip:
 		free(namelist[i]);
 	}
 	free(namelist);
-	return rc;
+	return result;
 }
 
 char buf[1024];
@@ -149,7 +150,7 @@ int scan_rom(char *path, char *file)
 {
 	struct dirent **namelist;
 	char *name, *path2;
-	int i, n, r, rc, result = 0;
+	int i, n, r, rc = 0, result = 0;
 	struct stat buf;
 
 	n = scandir(path, &namelist, 0, alphasort);
@@ -180,7 +181,7 @@ int scan_rom(char *path, char *file)
 			 * important thing is that no MCA happened.
 			 */
 			if (rc > 0)
-				fprintf(stderr, "PASS: %s read %ld bytes\n", path2, rc);
+				fprintf(stderr, "PASS: %s read %d bytes\n", path2, rc);
 			else {
 				fprintf(stderr, "PASS: %s not readable\n", path2);
 				return rc;
@@ -201,10 +202,10 @@ skip:
 		free(namelist[i]);
 	}
 	free(namelist);
-	return rc;
+	return result;
 }
 
-int main()
+int main(void)
 {
 	int rc;
 
@@ -256,4 +257,6 @@ int main()
 	scan_tree("/proc/bus/pci", "??.?", 0xA0000, 0x20000, 0);
 	scan_tree("/proc/bus/pci", "??.?", 0xC0000, 0x40000, 1);
 	scan_tree("/proc/bus/pci", "??.?", 0, 1024*1024, 0);
+
+	return rc;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ia64 aliasing-test: fix gcc warnings on non-ia64
  2008-01-16  0:05 [PATCH] ia64 aliasing-test: fix gcc warnings on non-ia64 Randy Dunlap
@ 2008-01-16 18:05 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2008-01-16 18:05 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, akpm

On Tuesday 15 January 2008 05:05:10 pm Randy Dunlap wrote:
> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> 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.
> ...
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>

Acked-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Thanks, Randy.

> ---
>  Documentation/ia64/aliasing-test.c |   15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> --- linux-2.6.24-rc7.orig/Documentation/ia64/aliasing-test.c
> +++ linux-2.6.24-rc7/Documentation/ia64/aliasing-test.c
> @@ -16,6 +16,7 @@
>  #include <fcntl.h>
>  #include <fnmatch.h>
>  #include <string.h>
> +#include <sys/ioctl.h>
>  #include <sys/mman.h>
>  #include <sys/stat.h>
>  #include <unistd.h>
> @@ -65,7 +66,7 @@ int scan_tree(char *path, char *file, of
>  {
>  	struct dirent **namelist;
>  	char *name, *path2;
> -	int i, n, r, rc, result = 0;
> +	int i, n, r, rc = 0, result = 0;
>  	struct stat buf;
>  
>  	n = scandir(path, &namelist, 0, alphasort);
> @@ -113,7 +114,7 @@ skip:
>  		free(namelist[i]);
>  	}
>  	free(namelist);
> -	return rc;
> +	return result;
>  }
>  
>  char buf[1024];
> @@ -149,7 +150,7 @@ int scan_rom(char *path, char *file)
>  {
>  	struct dirent **namelist;
>  	char *name, *path2;
> -	int i, n, r, rc, result = 0;
> +	int i, n, r, rc = 0, result = 0;
>  	struct stat buf;
>  
>  	n = scandir(path, &namelist, 0, alphasort);
> @@ -180,7 +181,7 @@ int scan_rom(char *path, char *file)
>  			 * important thing is that no MCA happened.
>  			 */
>  			if (rc > 0)
> -				fprintf(stderr, "PASS: %s read %ld bytes\n", path2, rc);
> +				fprintf(stderr, "PASS: %s read %d bytes\n", path2, rc);
>  			else {
>  				fprintf(stderr, "PASS: %s not readable\n", path2);
>  				return rc;
> @@ -201,10 +202,10 @@ skip:
>  		free(namelist[i]);
>  	}
>  	free(namelist);
> -	return rc;
> +	return result;
>  }
>  
> -int main()
> +int main(void)
>  {
>  	int rc;
>  
> @@ -256,4 +257,6 @@ int main()
>  	scan_tree("/proc/bus/pci", "??.?", 0xA0000, 0x20000, 0);
>  	scan_tree("/proc/bus/pci", "??.?", 0xC0000, 0x40000, 1);
>  	scan_tree("/proc/bus/pci", "??.?", 0, 1024*1024, 0);
> +
> +	return rc;
>  }
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-16 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-16  0:05 [PATCH] ia64 aliasing-test: fix gcc warnings on non-ia64 Randy Dunlap
2008-01-16 18:05 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).