From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755354AbbCCJAA (ORCPT ); Tue, 3 Mar 2015 04:00:00 -0500 Received: from bhuna.collabora.co.uk ([93.93.135.160]:34324 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752137AbbCCI76 (ORCPT ); Tue, 3 Mar 2015 03:59:58 -0500 From: Javier Martinez Canillas To: Tejun Heo Cc: Li Zefan , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Martinez Canillas Subject: [PATCH 1/1] cgroup: fix var may be used uninitialized warning Date: Tue, 3 Mar 2015 09:59:47 +0100 Message-Id: <1425373187-7227-1-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 2.1.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When building cgroup, GCC warns that the root variable may be used uninitialized in the cgroup_mount function. kernel/cgroup.c: In function ‘cgroup_mount’: kernel/cgroup.c:1886:13: warning: ‘root’ may be used uninitialized in this function [-Wuninitialized] kernel/cgroup.c:1742:22: note: ‘root’ was declared here This can never happen because if the struct cgroup_root can't be allocated, ret is set to -ENOMEM and the error returned so the code using root is not reachable. But set root to NULL just to silence the compiler warning. Signed-off-by: Javier Martinez Canillas --- This patch is on top of today's linux-next (tag: next-20150303). kernel/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 9a567836ee3a..bf1172d1c831 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -1739,7 +1739,7 @@ static struct dentry *cgroup_mount(struct file_system_type *fs_type, { struct super_block *pinned_sb = NULL; struct cgroup_subsys *ss; - struct cgroup_root *root; + struct cgroup_root *root = NULL; struct cgroup_sb_opts opts; struct dentry *dentry; int ret; -- 2.1.3