__chk_user_ptr() & __chk_io_ptr() are dummy extern functions which only exist to enforce the typechecking of __user or __iomem pointers in macros when using sparse. This typechecking is done by inserting a call to these functions. But the presence of these calls can inhibit some simplifications and so influence the result of sparse's analysis of context/locking. Fix this by changing these calls into static inline calls with an empty body.
Unified · Split
| @@ -11,8 +11,8 @@ · 10 unmodified lines | |||
| 11 | # define __iomem __attribute__((noderef, address_space(__iomem))) | 11 | # define __iomem __attribute__((noderef, address_space(__iomem))) |
| 12 | # define __percpu __attribute__((noderef, address_space(__percpu))) | 12 | # define __percpu __attribute__((noderef, address_space(__percpu))) |
| 13 | # define __rcu __attribute__((noderef, address_space(__rcu))) | 13 | # define __rcu __attribute__((noderef, address_space(__rcu))) |
| 14 | extern void __chk_user_ptr(const volatile void __user *); | 14 | static inline void __chk_user_ptr(const volatile void __user *ptr) { } |
| 15 | extern void __chk_io_ptr(const volatile void __iomem *); | 15 | static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } |
| 16 | /* context/locking */ | 16 | /* context/locking */ |
| 17 | # define __must_hold(x) __attribute__((context(x,1,1))) | 17 | # define __must_hold(x) __attribute__((context(x,1,1))) |
| 18 | # define __acquires(x) __attribute__((context(x,0,1))) | 18 | # define __acquires(x) __attribute__((context(x,0,1))) |