linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] romsignature/checksum cleanup
@ 2006-12-24 21:15 Rene Herman
  2006-12-25  0:53 ` Rene Herman
  0 siblings, 1 reply; 14+ messages in thread
From: Rene Herman @ 2006-12-24 21:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

[-- Attachment #1: Type: text/plain, Size: 204 bytes --]

Hi Andrew.

Use adding __init to romsignature() (it's only called from probe_roms() 
which is itself __init) as an excuse to submit a pedantic cleanup.

Signed-off-by: Rene Herman <rene.herman@gmail.com>

[-- Attachment #2: romsignature-checksum-cleanup.diff --]
[-- Type: text/plain, Size: 916 bytes --]

diff --git a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
index f391abc..2565fac 100644
--- a/arch/i386/kernel/e820.c
+++ b/arch/i386/kernel/e820.c
@@ -156,21 +156,22 @@ static struct resource standard_io_resou
 	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
 } };
 
-static int romsignature(const unsigned char *x)
+#define ROMSIGNATURE 0xaa55
+
+static int __init romsignature(const unsigned char *rom)
 {
 	unsigned short sig;
-	int ret = 0;
-	if (probe_kernel_address((const unsigned short *)x, sig) == 0)
-		ret = (sig == 0xaa55);
-	return ret;
+
+	return probe_kernel_address((const unsigned short *)rom, sig) == 0 &&
+	       sig == ROMSIGNATURE;
 }
 
 static int __init romchecksum(unsigned char *rom, unsigned long length)
 {
-	unsigned char *p, sum = 0;
+	unsigned char sum;
 
-	for (p = rom; p < rom + length; p++)
-		sum += *p;
+	for (sum = 0; length; length--)
+		sum += *rom++;
 	return sum == 0;
 }
 

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

end of thread, other threads:[~2007-01-08  2:50 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-24 21:15 [PATCH] romsignature/checksum cleanup Rene Herman
2006-12-25  0:53 ` Rene Herman
2006-12-27  0:31   ` Rusty Russell
2006-12-27  0:45     ` Rene Herman
2006-12-28  0:32     ` Zachary Amsden
2007-01-02 20:01       ` Rene Herman
2007-01-05 23:22         ` Jeremy Fitzhardinge
2007-01-06  3:46           ` Rene Herman
2007-01-07  8:59             ` Jeremy Fitzhardinge
2007-01-07  9:02               ` Rene Herman
2007-01-07 10:20                 ` Jeremy Fitzhardinge
2007-01-07 10:47                   ` Rene Herman
2007-01-07 18:07                     ` Jeremy Fitzhardinge
2007-01-08  2:48                       ` Rene Herman

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).