From patchwork Mon Oct 24 15:30:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101625 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2640326qge; Mon, 24 Oct 2016 08:31:17 -0700 (PDT) X-Received: by 10.98.9.147 with SMTP id 19mr29893519pfj.68.1477323076931; Mon, 24 Oct 2016 08:31:16 -0700 (PDT) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id r2si15963629pge.53.2016.10.24.08.31.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2016 08:31:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 847056E109; Mon, 24 Oct 2016 15:31:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.73]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC7F06E109 for ; Mon, 24 Oct 2016 15:31:12 +0000 (UTC) Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MIezY-1bwUIA0YlU-002GoV; Mon, 24 Oct 2016 17:31:02 +0200 From: Arnd Bergmann To: Ben Skeggs Subject: [PATCH] nouveau: hide gcc-4.9 -Wmaybe-uninitialized Date: Mon, 24 Oct 2016 17:30:38 +0200 Message-Id: <20161024153059.2713363-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:5nZEbNbfK4Tq8dUrciHNvEYrvY86MAPU6RplQjp1G4k1pBMFPH3 hbPqYUbcYI9NygEnSixgPmMvDmmhfLyDAQaS+MpviYJQ2dYgeSJMJ3htW9jz//xwIBqng6g MthyI+BtI0CTy/tkoWv3gl30KfikXvWY8VbtScwaJPlqfUBgAdk8YCObPRK9ESOVhArmh7b 7T28k8qdQjjTSNGQM34cw== X-UI-Out-Filterresults: notjunk:1; V01:K0:j8A4QITlMTk=:OaZOKKE2Xst1EBYZo0KNSu evIy6xnuN1ObbX6G1Jlhf1XvBiBctU3RQVxQxPMyeY6fzj3ArJC+6Gno3UkWE6eo29XF/RY+T pH/ILQLVYAiVGdFGjW8xN5GQdpxg1fxXC57vivg93NQCmQ5J4bdbFaMBgYpaoO3idAB9N2v/W jgQIPsH4i2eoNykOMTP5ZCUl8D0WkWYO5jWpDWG3Br450IwAl9iVR1OBbdxyjqke9gMkpXq56 5Y2JHtJwIgJlDeXb6gYT67YqkFSN2L+n3woKILMgHlwi0POdF+z6jA5tw6OyrQKwPQGiKY+Ry OyCDsvWEIh47w3FuoUt9wU5zDMYitTM7oP1fFK+lK09KbvQyu1XsZ3WW80r/O/DmNNg2lKTjk qUV2d2NOM0fIhxd2iMpnAIAYwASJeYQCPTOcmnKCR5eZMucyENlUC7BNDwhh4p4RBGxwgYX5w 8NOJ/ljxqoIIVCqS7WW6qzkEzSFNpWshZVKreRC59yHlgJrkClNT+Io88xRkKo2nteItLDXp1 kUptEabOhn5Iy61gAatbEyf3sQi/rZQiAgh1z//kQ2KwQ3baTdIgEm34ne0tqifM+t7dIbhTK I/kP7wYmeYzLPnpSJV7UebdNu39wkTmUUXOfSQly44fvxxjBvukRm83ZbnGd4XmkVYUUQjhUG qGfEoOT4yQaUpFHvWXsl4Cn6dMiwrFcGO8GJxw7vARZ7rmOB4E+FZo7Iua9l4D2sYAd8CBevj M1BtHOt/C1TTtmtL Cc: Arnd Bergmann , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, Alex Deucher X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" gcc-4.9 notices that the validate_init() function returns unintialized data when called with a zero 'nr_buffers' argument, when called with the -Wmaybe-uninitialized flag: drivers/gpu/drm/nouveau/nouveau_gem.c: In function ‘validate_init.isra.6’: drivers/gpu/drm/nouveau/nouveau_gem.c:457:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized] However, the only caller of this function always passes a nonzero argument, and gcc-6 is clever enough to take this into account and not warn about it any more. Adding an explicit initialization to -EINVAL here is correct even if the caller changed, and it avoids the warning on gcc-4.9 as well. Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/nouveau/nouveau_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 0bd7164bc817..4f3c5f3eaa16 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -369,7 +369,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv, { struct nouveau_cli *cli = nouveau_cli(file_priv); int trycnt = 0; - int ret, i; + int ret = -EINVAL, i; struct nouveau_bo *res_bo = NULL; LIST_HEAD(gart_list); LIST_HEAD(vram_list);