Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751158AbbEGPNZ (ORCPT ); Thu, 7 May 2015 11:13:25 -0400 Received: from www.osadl.org ([62.245.132.105]:37313 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751035AbbEGPNU (ORCPT ); Thu, 7 May 2015 11:13:20 -0400 From: Nicholas Mc Guire To: Ingo Molnar Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH RFC] sched/completion: match return type to function signatures Date: Thu, 7 May 2015 17:04:44 +0200 Message-Id: <1431011084-29177-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2763 Lines: 82 try_wait_for_completion is declared bool but returns int, wait_for_completion_interruptible is declared int but can return long wait_for_completion_killable also is declared int but can return long to resolve this return types and/or return statements are fixed up. Signed-off-by: Nicholas Mc Guire --- type-checking kernel functions with some experimental coccinelle spatches gave me: HANDLING: kernel/sched/completion.c kernel/sched/completion.c:192 WARNING: return of wrong type - int != long, kernel/sched/completion.c:229 WARNING: return of wrong type - int != long, kernel/sched/completion.c:286 WARNING: return of wrong type - bool != int, this patch fixes up these type mismatches. Not sure if such "type cleanups" are wanted - there are quite a few of them many might be considered benign though type mismatches can lead to quite hard to locate issues. If this makes sense to clean up such mismatches then a few more patches will follow, pleas let me know. Patch was compile tested with x86_64_defconfig Patch is against 4.1-rc2 (localversion-next is -next-20150506) kernel/sched/completion.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c index 8d0f35d..0b97a10 100644 --- a/kernel/sched/completion.c +++ b/kernel/sched/completion.c @@ -189,7 +189,7 @@ int __sched wait_for_completion_interruptible(struct completion *x) { long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_INTERRUPTIBLE); if (t == -ERESTARTSYS) - return t; + return -ERESTARTSYS; return 0; } EXPORT_SYMBOL(wait_for_completion_interruptible); @@ -226,7 +226,7 @@ int __sched wait_for_completion_killable(struct completion *x) { long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE); if (t == -ERESTARTSYS) - return t; + return -ERESTARTSYS; return 0; } EXPORT_SYMBOL(wait_for_completion_killable); @@ -266,7 +266,7 @@ EXPORT_SYMBOL(wait_for_completion_killable_timeout); bool try_wait_for_completion(struct completion *x) { unsigned long flags; - int ret = 1; + bool ret = true; /* * Since x->done will need to be locked only @@ -275,11 +275,11 @@ bool try_wait_for_completion(struct completion *x) * return early in the blocking case. */ if (!READ_ONCE(x->done)) - return 0; + return false; spin_lock_irqsave(&x->wait.lock, flags); if (!x->done) - ret = 0; + ret = false; else x->done--; spin_unlock_irqrestore(&x->wait.lock, flags); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/