Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752072AbbEQGBm (ORCPT ); Sun, 17 May 2015 02:01:42 -0400 Received: from terminus.zytor.com ([198.137.202.10]:53788 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbbEQGBe (ORCPT ); Sun, 17 May 2015 02:01:34 -0400 Date: Sat, 16 May 2015 23:00:39 -0700 From: tip-bot for Nicholas Mc Guire Message-ID: Cc: torvalds@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, hofrat@osadl.org, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org Reply-To: torvalds@linux-foundation.org, tglx@linutronix.de, peterz@infradead.org, hofrat@osadl.org, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org In-Reply-To: <1431716742-11077-1-git-send-email-hofrat@osadl.org> References: <1431716742-11077-1-git-send-email-hofrat@osadl.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched: Fix function declaration return type mismatch Git-Commit-ID: 58ac93e4f2e4b15beffdf0e3749b7fea3208ef66 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3055 Lines: 85 Commit-ID: 58ac93e4f2e4b15beffdf0e3749b7fea3208ef66 Gitweb: http://git.kernel.org/tip/58ac93e4f2e4b15beffdf0e3749b7fea3208ef66 Author: Nicholas Mc Guire AuthorDate: Fri, 15 May 2015 21:05:42 +0200 Committer: Ingo Molnar CommitDate: Sun, 17 May 2015 06:47:46 +0200 sched: Fix function declaration return type mismatch static code checking was unhappy with: ./kernel/sched/fair.c:162 WARNING: return of wrong type int != unsigned int get_update_sysctl_factor() is declared to return int but is currently returning an unsigned int. The first few preprocessed lines are: static int get_update_sysctl_factor(void) { unsigned int cpus = ({ int __min1 = (cpumask_weight(cpu_online_mask)); int __min2 = (8); __min1 < __min2 ? __min1: __min2; }); unsigned int factor; The type used by min_t() should be 'unsigned int' and the return type of get_update_sysctl_factor() should also be 'unsigned int' as its call-site update_sysctl() is expecting 'unsigned int' and the values utilizing: 'factor' 'sysctl_sched_min_granularity' 'sched_nr_latency' 'sysctl_sched_wakeup_granularity' ... are also all 'unsigned int', plus cpumask_weight() is also returning 'unsigned int'. So the natural type to use around here is 'unsigned int'. ( Patch was compile tested with x86_64_defconfig + CONFIG_SCHED_DEBUG=y and the changed sections in kernel/sched/fair.i were reviewed. ) Signed-off-by: Nicholas Mc Guire [ Improved the changelog a bit. ] Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1431716742-11077-1-git-send-email-hofrat@osadl.org Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f18ddb7..a27d988 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -141,9 +141,9 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w) * * This idea comes from the SD scheduler of Con Kolivas: */ -static int get_update_sysctl_factor(void) +static unsigned int get_update_sysctl_factor(void) { - unsigned int cpus = min_t(int, num_online_cpus(), 8); + unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8); unsigned int factor; switch (sysctl_sched_tunable_scaling) { @@ -576,7 +576,7 @@ int sched_proc_update_handler(struct ctl_table *table, int write, loff_t *ppos) { int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); - int factor = get_update_sysctl_factor(); + unsigned int factor = get_update_sysctl_factor(); if (ret || !write) return ret; -- 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/