Skip to contentSkip to conversation

mm/mlock.c: change can_do_mlock return value type to boolean

PATCH Andrew Morton 1 participant 1 message Jan 8, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20160108203823.348f2a17@debian

Andrew Morton

author maintainer
#1 lore raw
Quoted 15 lines · On Fri, 8 Jan 2016 20:38:23 +0800 Wang Xiaoqiang <[email protected]> wrote:

Since can_do_mlock only return 1 or 0, so make it boolean.

No functional change.

...

mm/mlock.c +1 -1
@@ -24,13 +24,13 @@
 
 #include "internal.h"
 
-int can_do_mlock(void)
+bool can_do_mlock(void)
 {

mm/mlock.c line 35

Quoted 10 lines
mm/mlock.c +3 -3
 	if (rlimit(RLIMIT_MEMLOCK) != 0)
-		return 1;
+		return true;
 	if (capable(CAP_IPC_LOCK))
-		return 1;
-	return 0;
+		return true;
+	return false;
 }
 EXPORT_SYMBOL(can_do_mlock);

Please never send untested patches. Ever.

include/linux/mm.h renamed from include/linux/mm.h~mm-mlockc-change-can_do_mlock-return-value-type-to-boolean-fix +1 -1
@@ -1100,7 +1100,7 @@ static inline bool shmem_mapping(struct
 }
 #endif
 
-extern int can_do_mlock(void);
+extern bool can_do_mlock(void);
 extern int user_shm_lock(size_t, struct user_struct *);
 extern void user_shm_unlock(size_t, struct user_struct *);
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>