Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753695AbdGNJ2H (ORCPT ); Fri, 14 Jul 2017 05:28:07 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1599 Lines: 39 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, -- 2.9.0