patch-2.1.106 linux/include/linux/adfs_fs.h

Next file: linux/include/linux/bitops.h
Previous file: linux/include/asm-sparc64/bitops.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.105/linux/include/linux/adfs_fs.h linux/include/linux/adfs_fs.h
@@ -111,30 +111,22 @@
 };
 
 #ifdef __KERNEL__
-
-
 /*
  * Calculate the boot block checksum on an ADFS drive.  Note that this will
  * appear to be correct if the sector contains all zeros, so also check that
  * the disk size is non-zero!!!
  */
- 
 extern inline int adfs_checkbblk(unsigned char *ptr)
 {
-	int i = 511;
-
-	int result = 0;
+	unsigned int result = 0;
+	unsigned char *p = ptr + 511;
 
 	do {
-		result = (result & 0xff) + (result >> 8);
-		result = result + ptr[i];
-		i--;
-	}
-	while (i != 0);
-	
-	result &= 0xff;
-	return result != ptr[511];
-	return 0;
+	        result = (result & 0xff) + (result >> 8);
+        	result = result + *--p;
+	} while (p != ptr);
+
+	return (result & 0xff) != ptr[511];
 }
 
 /* dir.c */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov