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: 9840285 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 D0FB9603F3 for ; Fri, 14 Jul 2017 09:28:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEEB42876A for ; Fri, 14 Jul 2017 09:28:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B36122876E; Fri, 14 Jul 2017 09:28:40 +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=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 596AE28791 for ; Fri, 14 Jul 2017 09:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753678AbdGNJ2F (ORCPT ); Fri, 14 Jul 2017 05:28:05 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:54810 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753272AbdGNJ2D (ORCPT ); Fri, 14 Jul 2017 05:28:03 -0400 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 Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, akpm@linux-foundation.org, dri-devel@lists.freedesktop.org, Arnd Bergmann , Brian Paul 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== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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,