lib: lcm.c: make __attribute_const__ consistent
PATCH 1/1 lib: lcm.c: make __attribute_const__ consistent
The lcm and lcm_not_zero() are producing sparse warnings due to the use of __attribute_const__ in the header but not in the lcm.c file. Add the __attribute_const__ to lcm.c and make the header consistent with using the attribute before the function to fix the following sparse warnings:
lib/lcm.c:7:15: error: symbol 'lcm' redeclared with different type (originally declared at include/linux/lcm.h:6) - different modifiers lib/lcm.c:16:15: error: symbol 'lcm_not_zero' redeclared with different type (originally declared at include/linux/lcm.h:7) - different modifiers
---
Cc: [email protected]
Note, this makes scripts/get_maintainer.pl go:
Bad divisor in main::vcs_assign: 0
Bad divisor in main::vcs_assign: 0
--- include/linux/lcm.h | 4 ++-- lib/lcm.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/lcm.h +2 -2
@@ -3,7 +3,7 @@#include <linux/compiler.h> -unsigned long lcm(unsigned long a, unsigned long b) __attribute_const__; -unsigned long lcm_not_zero(unsigned long a, unsigned long b) __attribute_const__; +unsigned long __attribute_const__ lcm (unsigned long a,unsigned long b); +unsigned long __attribute_const__ lcm_not_zero (unsigned long a,unsigned long b);#endif /* _LCM_H */
lib/lcm.c +2 -2
@@ -4,7 +4,7 @@#include <linux/lcm.h> /* Lowest common multiple */ -unsigned long lcm (unsigned long a,unsigned long b) +unsigned long __attribute_const__ lcm (unsigned long a,unsigned long b) {if (a && b)return (a /gcd (a, b)) * b;
@@ -13,7 +13,7 @@ unsigned long lcm(unsigned long a, unsigned long b) }EXPORT_SYMBOL_GPL (lcm); -unsigned long lcm_not_zero (unsigned long a,unsigned long b) +unsigned long __attribute_const__ lcm_not_zero (unsigned long a,unsigned long b) {unsigned long l =lcm (a, b);
Signature · 1 line
2.8.1