Skip to content

Commit b7ec62d

Browse files
committed
bitops: protect find_first_{,zero}_bit properly
find_first_bit() and find_first_zero_bit() are not protected with ifdefs as other functions in find.h. It causes build errors on some platforms if CONFIG_GENERIC_FIND_FIRST_BIT is enabled. Signed-off-by: Yury Norov <[email protected]> Fixes: 2cc7b6a ("lib: add fast path for find_first_*_bit() and find_last_bit()") Reported-by: kernel test robot <[email protected]> Tested-by: Wolfram Sang <[email protected]>
1 parent df0cc57 commit b7ec62d

File tree

1 file changed

+5
-0
lines changed
  • include/asm-generic/bitops

1 file changed

+5
-0
lines changed

include/asm-generic/bitops/find.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
9797

9898
#ifdef CONFIG_GENERIC_FIND_FIRST_BIT
9999

100+
#ifndef find_first_bit
100101
/**
101102
* find_first_bit - find the first set bit in a memory region
102103
* @addr: The address to start the search at
@@ -116,7 +117,9 @@ unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
116117

117118
return _find_first_bit(addr, size);
118119
}
120+
#endif
119121

122+
#ifndef find_first_zero_bit
120123
/**
121124
* find_first_zero_bit - find the first cleared bit in a memory region
122125
* @addr: The address to start the search at
@@ -136,6 +139,8 @@ unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
136139

137140
return _find_first_zero_bit(addr, size);
138141
}
142+
#endif
143+
139144
#else /* CONFIG_GENERIC_FIND_FIRST_BIT */
140145

141146
#ifndef find_first_bit

0 commit comments

Comments
 (0)