From: Arnd Bergmann <arnd@arndb.de>
To: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
VMware Graphics <linux-graphics-maintainer@vmware.com>,
Sinclair Yeh <syeh@vmware.com>, David Airlie <airlied@linux.ie>,
Brian Paul <brianp@vmware.com>,
Charmaine Lee <charmainel@vmware.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/vmwgfx: avoid gcc-7 parentheses warning
Date: Wed, 16 Nov 2016 15:19:31 +0100 [thread overview]
Message-ID: <20161116141949.2052696-1-arnd@arndb.de> (raw)
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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
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
next reply other threads:[~2016-11-16 14:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 14:19 Arnd Bergmann [this message]
2016-11-17 2:25 ` Sinclair Yeh
2017-03-14 21:05 Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161116141949.2052696-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=airlied@linux.ie \
--cc=brianp@vmware.com \
--cc=charmainel@vmware.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-graphics-maintainer@vmware.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syeh@vmware.com \
--cc=thellstrom@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®