From patchwork Fri Jul 14 09:25:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9840271 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 2E408602BD for ; Fri, 14 Jul 2017 09:27:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CAFB2817F for ; Fri, 14 Jul 2017 09:27:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1181B2875A; Fri, 14 Jul 2017 09:27:41 +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 901222817F for ; Fri, 14 Jul 2017 09:27:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E5FB86E7B7; Fri, 14 Jul 2017 09:27:39 +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.17.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EC246E7B7 for ; Fri, 14 Jul 2017 09:27:37 +0000 (UTC) Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0LqFFo-1e9QU502AS-00dodI; Fri, 14 Jul 2017 11:26:49 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, VMware Graphics , Sinclair Yeh , Thomas Hellstrom , David Airlie Subject: [PATCH, RESEND 03/14] drm/vmwgfx: avoid gcc-7 parentheses warning Date: Fri, 14 Jul 2017 11:25:15 +0200 Message-Id: <20170714092540.1217397-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714092540.1217397-1-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> X-Provags-ID: V03:K0:ak6ADH+6EZDPsYMUUuDcxzct0lASSGv/e7NEU13ahmMkPtIlLBs veuGwmStCqPepvdmxVRdOoOLDpHXWv2tQUPbuDCLJSEgI5aB8Tx5XrfMk29SSWTnsGeN3sn eWhwKUmLDnCTfJ0N67O8WEUKtxLm9v9OJuV52bBWX7+xaGvemFDbNYmZw2C+xeYNQ167a98 1hYDxa7E7y0O6tMlzyckQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:h0UAhwwZh70=:CXpqXEf7h0UOiFz+ZjnrsC 8v7qx4eyJfpgoRqEQXKxp1PjyPM7Jbxk0gt3jw9ZFDVxJssxDHZUOJrZXJbtxVq5GGEwI0/YE xVqbeDLUNpeq67tbK9c9x70R/1u2llL0Visx0cd8jGSEQadSbNlKDwSA8iqdGiYeHzZH9/BNn gD88hl0oAR6E15cVHN0U/oTtYknVzZboTcUUj0lhOUZ0Gw4TkfSSLA8ulJ9lob5SL2lsrpDPr Ry+vm8BjWpr8VdbbXrew28Fmnjs8vAdWfg+5aihQQM7IB4inH1jQ2FJj5NJa82QQKMj50ylYk ukHR9dFdDF0jIWMeui4BMwEDRCR/nAHvxw6YhEqsQ2yTQu/91nBBMHt3DOnqn+/AbbnNRdhzh tCXLCeuHbUem3jKpQpYmtpASXVi/M4db/8K+8j+DVtWwp0bvLU87HlQSGO/ql1Z9IWVoi2QZJ pnQem3i7Iv2vBieybUT/wzKpMojHjKhi8Dyr7TWmjmOMYgQEw5Y3m6TppA0Ve0xNwdPdFesth JGXSY6ve6lnAwopRyRbQ7uX4VyTK3N353/CF4Vd+1z6OwM/bLk6HrvWQcoqnRd+Y1k/q5dRYZ AZXZl3HxWXQR0p/dFwndjR4zBexPuNTf3WiCRgU+bb0XKSX547JR/ux+wltqcmL7eGKj+r6rH CqIy0tsOdDOkK77mQBDnMb3HSNQvFV0RHywvYQEO9UvkGe9zZBInvZD6uKMHQOreNl6MzfRO6 up8H13tBmkXnWDz2GUEpwnXWxKyGnXlpZAZl6g== Cc: Arnd Bergmann , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Brian Paul , Tejun Heo , akpm@linux-foundation.org, Linus Torvalds , Guenter Roeck , linux-media@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,