Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Optimize get_user and put_user for 64-bit

A long for the error value leads to unnecessary sign extensions. This
patch shrinks an ip27_defconfig kernel build with gcc 4.3.0 by 2256 bytes.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

+4 -4
+4 -4
include/asm-mips/uaccess.h
··· 224 224 225 225 #define __get_user_nocheck(x, ptr, size) \ 226 226 ({ \ 227 - long __gu_err; \ 227 + int __gu_err; \ 228 228 \ 229 229 __get_user_common((x), size, ptr); \ 230 230 __gu_err; \ ··· 232 232 233 233 #define __get_user_check(x, ptr, size) \ 234 234 ({ \ 235 - long __gu_err = -EFAULT; \ 235 + int __gu_err = -EFAULT; \ 236 236 const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); \ 237 237 \ 238 238 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ ··· 304 304 #define __put_user_nocheck(x, ptr, size) \ 305 305 ({ \ 306 306 __typeof__(*(ptr)) __pu_val; \ 307 - long __pu_err = 0; \ 307 + int __pu_err = 0; \ 308 308 \ 309 309 __pu_val = (x); \ 310 310 switch (size) { \ ··· 321 321 ({ \ 322 322 __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ 323 323 __typeof__(*(ptr)) __pu_val = (x); \ 324 - long __pu_err = -EFAULT; \ 324 + int __pu_err = -EFAULT; \ 325 325 \ 326 326 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \ 327 327 switch (size) { \