From patchwork Tue Mar 14 21:05:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9624507 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 4AC29604CC for ; Tue, 14 Mar 2017 21:05:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D8D7285D1 for ; Tue, 14 Mar 2017 21:05:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 325F4285DC; Tue, 14 Mar 2017 21:05:46 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 C6812285D1 for ; Tue, 14 Mar 2017 21:05:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C902D6E7C8; Tue, 14 Mar 2017 21:05:43 +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 [212.227.126.134]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9BD46E7C8 for ; Tue, 14 Mar 2017 21:05:41 +0000 (UTC) Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0MHKOl-1d1vzw0H7z-00E6O3; Tue, 14 Mar 2017 22:05:35 +0100 From: Arnd Bergmann To: VMware Graphics , Sinclair Yeh , Thomas Hellstrom , David Airlie Subject: [PATCH] drm/vmwgfx: avoid gcc-7 parentheses warning Date: Tue, 14 Mar 2017 22:05:10 +0100 Message-Id: <20170314210528.3300313-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:a6BNoNV07mDjPRgOK04mNmH1uLvfltfOjXzm+2eNVWx9oVYWtE0 md8RDrR5oUL8dYW+1FA16/lmxTMWBCA2VBL+9n0skndnTaZcFzJOyPcREQ+jvX8Tb3b+bGM N1E7TvnYsLKM/hb7DckXxp4i1iT6SeAfYIg82s+T/AH1wGyHP6Xk6q3ueGeckk7B2oZGzXj OPW61zc0SlVaUFjF/lDCg== X-UI-Out-Filterresults: notjunk:1; V01:K0:2fK/OlqKyZ4=:sz+uTPLHkJlaqS3vpTtk3Y VjVZTFGEiUt+WW1qxWfZ31hY6+nmcG/RxLC+MRraH8ZLAbpEfa433JXjum09HWRsH4dhRS0Ma DDwY5AOpPrinbCrygsbpz4nmirt92CPutZii3x/6jpAt4pRxizae0WVSCdvnKH1QHhCydvtGh PwGPkvH9sM6HNt/rxDqeJsQUCFAFMoup7XJo2aUHt6A2S3TUL9pjYkjtPb4x0lGmzdhQeafAR PsWBWQ6ojLgO6T1a6iFfSfPKrnPy7nQHLjPL1/8YXnomY11LMzUIsgx2vnLj5Dkv9XThsrd6q HYw1vbV/PsY+anGpr9NK8Btb+ZL+0Vxq8ZtjvCx7qquKKDUyrSosVZqlHCpCLnIJJAoohws17 NES98CPs0sO/qhEqpxiw7/0ScgFzsS/l1KrOh8uRE4HODLD/TozXMU7hx//4LUf0VHl0bzq21 XsoxazRNN3erW63dS8jiab26o1HbJLDkihNAt9/EZpE45DtqLQZHjxUJSVPh1OQWXlFHot9X1 u6ACKiP5/tmarOHRCf8ymCcayFubAkPaC6UXTgmpBtt8aCLN2+jsqGKugQXoftGQ8dWRBD60h hXc/dvA2xuDpmJZ+EQAuuYKw2Tu9DIYXrX8QHRrnEXtWYl5fQmCgGbxOGwXAbdEFb9ipWPptm TImNZgU2MvzB6rvFpTUUBmkHOcXbFzYx3FhwZ25TBJc3oLfF3cq3nQzWqR8oznKXZ1NE= Cc: Charmaine Lee , Brian Paul , dri-devel@lists.freedesktop.org, Arnd Bergmann , linux-kernel@vger.kernel.org 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP gcc-7 warns about slightly suspicious code in vmw_cmd_invalid: drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c: In function 'vmw_cmd_invalid': drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:522:23: error: the omitted middle operand in ?: will always be 'true', suggest explicit middle operand [-Werror=parentheses] The problem is that it is mixing boolean and integer values here. I assume that the code actually works correctly, so making it use a literal '1' instead of the implied 'true' makes it more readable and avoids the warning. The code has been in this file since the start, but it could make sense to backport this patch to stable to make it build cleanly with gcc-7. Fixes: fb1d9738ca05 ("drm/vmwgfx: Add DRM driver for VMware Virtual GPU") Reviewed-by: Sinclair Yeh Signed-off-by: Arnd Bergmann --- Originally submitted on Nov 16, but for some reason it never appeared upstream. The patch is still needed as of v4.11-rc2 --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index c7b53d987f06..3f343e55972a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -519,7 +519,7 @@ static int vmw_cmd_invalid(struct vmw_private *dev_priv, struct vmw_sw_context *sw_context, SVGA3dCmdHeader *header) { - return capable(CAP_SYS_ADMIN) ? : -EINVAL; + return capable(CAP_SYS_ADMIN) ? 1 : -EINVAL; } static int vmw_cmd_ok(struct vmw_private *dev_priv,