Skip to contentSkip to conversation

freezer: fix return value of freezable_schedule_timeout_killable

PATCH Applied Jeff Layton 2 participants 2 messages Dec 24, 2011 – Dec 27, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 freezer: fix return value of freezable_schedule_timeout_killable

...it should return the return code from schedule_timeout_killable(), not the one from freezer_count().

All of the current callers ignore the return code so the bug is harmless but it's worth fixing.

---
 include/linux/freezer.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/freezer.h +3 -1
index 30f06c2..96b5b59 100644
@@ -122,9 +122,11 @@ static inline int freezer_should_skip(struct task_struct *p)
 /* Like schedule_timeout_killable(), but should not block the freezer. */
 #define freezable_schedule_timeout_killable(timeout)			\
 ({									\
+	long __retval;							\
 	freezer_do_not_count();						\
-	schedule_timeout_killable(timeout);				\
+	__retval = schedule_timeout_killable(timeout);			\
 	freezer_count();						\
+	__retval;							\
 })
 
 /*
Signature · 1 line
1.7.7.4
#1 lore raw
Quoted 7 lines · Jeff Layton

...it should return the return code from schedule_timeout_killable(), not the one from freezer_count().

All of the current callers ignore the return code so the bug is harmless but it's worth fixing.

Applied to linux-pm/pm-freezer, will be pushed for 3.3.

Thanks,
Rafael

Quoted 22 lines
---
 include/linux/freezer.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
include/linux/freezer.h +3 -1
index 30f06c2..96b5b59 100644
@@ -122,9 +122,11 @@ static inline int freezer_should_skip(struct task_struct *p)
 /* Like schedule_timeout_killable(), but should not block the freezer. */
 #define freezable_schedule_timeout_killable(timeout)			\
 ({									\
+	long __retval;							\
 	freezer_do_not_count();						\
-	schedule_timeout_killable(timeout);				\
+	__retval = schedule_timeout_killable(timeout);			\
 	freezer_count();						\
+	__retval;							\
 })
 
 /*