patch-2.2.17 linux/include/asm-ppc/bitops.h

Next file: linux/include/asm-ppc/bootx.h
Previous file: linux/include/asm-i386/processor.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.16/include/asm-ppc/bitops.h linux/include/asm-ppc/bitops.h
@@ -104,6 +104,8 @@
 	tmp = *p;
 found_first:
 	tmp |= ~0UL << size;
+	if (tmp == ~0UL)        /* Are any bits zero? */
+		return result + size; /* Nope. */
 found_middle:
 	return result + ffz(tmp);
 }
@@ -194,6 +196,8 @@
 	tmp = cpu_to_le32p(p);
 found_first:
 	tmp |= ~0U << size;
+	if (tmp == ~0UL)        /* Are any bits zero? */
+		return result + size; /* Nope. */
 found_middle:
 	return result + ffz(tmp);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)