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: 9392349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 977D26077A for ; Mon, 24 Oct 2016 15:31:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8AD5328F7E for ; Mon, 24 Oct 2016 15:31:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EFB529094; Mon, 24 Oct 2016 15:31:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6836B28F7E for ; Mon, 24 Oct 2016 15:31:17 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-By: Karol Herbst --- 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);