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: 107743 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp649186qge; Fri, 14 Jul 2017 02:27:40 -0700 (PDT) X-Received: by 10.98.193.197 with SMTP id i188mr4159599pfg.215.1500024460745; Fri, 14 Jul 2017 02:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500024460; cv=none; d=google.com; s=arc-20160816; b=SxwFUm0vfNlutE8F3FBhjVDshu1ccRkgQtu/w6GIFX1DGMrjzr3Tetxmba5eSI6eZF coBtZxEuJ0g6EacKXOwbEUr2PcBqROzJ/apA1QRx3MNl8NlIh0i6mzd0JbbSasVB33df 16sm6Fp1tvEzJ0DTeXzXgpxGRDkOBYt9PwDvgVknMxc2n9Y2gMzZmJ343oPpnUW4/lqf wutlFcs/x9KLkT6RNwj4n7yibOwsDDtwOYP/W1N1cjWvQp/9g6EYe2aEbeM4/UxqlaHI n0vQV4kVy+P6vQiy3tjlcOWR1D82MSWoBk5Jq0EO94A/RMcYp+xLJIXaA79mhHIygVB9 jSmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:message-id:date :subject:to:from:delivered-to:arc-authentication-results; bh=clu+2gQv3f3ia9qIFfaYA7ah12jQ34gf9PEuGQUfxto=; b=E5+eTlSazk9Tp5sdZTdqKayWpgeFwdgLKGZPBMwDjxgxCUvF2zLheLzbTzJXF4itgv +urwDUfTKKF9BMlXBvDehauBt/NjflVM6xTFhq4ltY4qQvGlwcLJcRmu56fGSh4dR2uf 01dFcLG9dBD6ZwW7QDWl2K6PT6VBj/uJSpNiMvcSSBch04G0sOqn+bBhbxPH9CflkyDp 1VRsllNEvUAC91i1OwoUP4FPKZvu0NZQBhauT+L7JX3J/F4h4Xz3oyPxo7mQiY2eiYHS 0s6H223HE3XMhFFoqnMJDvGXjVnLYgPWyILPEgKh5u+eGsO8AoX9Ofj6nsW1dkc9RNDA hMHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 1si6225923pgm.406.2017.07.14.02.27.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 02:27:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org 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" 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,