* [PATCH] dm ioctl: Remove double parentheses
@ 2017-03-16 16:48 Matthias Kaehlcke
2017-04-01 1:50 ` Matthias Kaehlcke
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Kaehlcke @ 2017-03-16 16:48 UTC (permalink / raw)
To: Alasdair Kergon, Mike Snitzer, dm-devel
Cc: Shaohua Li, linux-raid, linux-kernel, Grant Grundler,
Michael Davidson, Greg Hackmann, Matthias Kaehlcke
The extra pair of parantheses is not needed and causes clang to generate
the following warning:
drivers/md/dm-ioctl.c:1776:11: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
if ((cmd == DM_DEV_CREATE_CMD)) {
~~~~^~~~~~~~~~~~~~~~~~~~
drivers/md/dm-ioctl.c:1776:11: note: remove extraneous parentheses around the comparison to silence this warning
if ((cmd == DM_DEV_CREATE_CMD)) {
~ ^ ~
drivers/md/dm-ioctl.c:1776:11: note: use '=' to turn this equality comparison into an assignment
if ((cmd == DM_DEV_CREATE_CMD)) {
^~
=
Also remove another double parentheses that don't cause a warning.
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
drivers/md/dm-ioctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index a5a9b17f0f7f..9360036bf6d3 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1777,12 +1777,12 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
cmd == DM_LIST_VERSIONS_CMD)
return 0;
- if ((cmd == DM_DEV_CREATE_CMD)) {
+ if (cmd == DM_DEV_CREATE_CMD) {
if (!*param->name) {
DMWARN("name not supplied when creating device");
return -EINVAL;
}
- } else if ((*param->uuid && *param->name)) {
+ } else if (*param->uuid && *param->name) {
DMWARN("only supply one of name or uuid, cmd(%u)", cmd);
return -EINVAL;
}
--
2.12.0.367.g23dc2f6d3c-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] dm ioctl: Remove double parentheses
2017-03-16 16:48 [PATCH] dm ioctl: Remove double parentheses Matthias Kaehlcke
@ 2017-04-01 1:50 ` Matthias Kaehlcke
2017-04-01 2:07 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Matthias Kaehlcke @ 2017-04-01 1:50 UTC (permalink / raw)
To: Alasdair Kergon, Mike Snitzer, dm-devel
Cc: Shaohua Li, linux-raid, linux-kernel, Grant Grundler,
Michael Davidson, Greg Hackmann
El Thu, Mar 16, 2017 at 09:48:30AM -0700 Matthias Kaehlcke ha dit:
> The extra pair of parantheses is not needed and causes clang to generate
> the following warning:
>
> drivers/md/dm-ioctl.c:1776:11: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
> if ((cmd == DM_DEV_CREATE_CMD)) {
> ~~~~^~~~~~~~~~~~~~~~~~~~
> drivers/md/dm-ioctl.c:1776:11: note: remove extraneous parentheses around the comparison to silence this warning
> if ((cmd == DM_DEV_CREATE_CMD)) {
> ~ ^ ~
> drivers/md/dm-ioctl.c:1776:11: note: use '=' to turn this equality comparison into an assignment
> if ((cmd == DM_DEV_CREATE_CMD)) {
> ^~
> =
>
> Also remove another double parentheses that don't cause a warning.
>
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> ---
> drivers/md/dm-ioctl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
> index a5a9b17f0f7f..9360036bf6d3 100644
> --- a/drivers/md/dm-ioctl.c
> +++ b/drivers/md/dm-ioctl.c
> @@ -1777,12 +1777,12 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
> cmd == DM_LIST_VERSIONS_CMD)
> return 0;
>
> - if ((cmd == DM_DEV_CREATE_CMD)) {
> + if (cmd == DM_DEV_CREATE_CMD) {
> if (!*param->name) {
> DMWARN("name not supplied when creating device");
> return -EINVAL;
> }
> - } else if ((*param->uuid && *param->name)) {
> + } else if (*param->uuid && *param->name) {
> DMWARN("only supply one of name or uuid, cmd(%u)", cmd);
> return -EINVAL;
> }
Ping? Any feedback on this patch?
Cheers
Matthias
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dm ioctl: Remove double parentheses
2017-04-01 1:50 ` Matthias Kaehlcke
@ 2017-04-01 2:07 ` Joe Perches
2017-04-03 16:56 ` Matthias Kaehlcke
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2017-04-01 2:07 UTC (permalink / raw)
To: Matthias Kaehlcke, Alasdair Kergon, Mike Snitzer, dm-devel
Cc: Michael Davidson, Grant Grundler, linux-kernel, Greg Hackmann,
linux-raid, Shaohua Li
On Fri, 2017-03-31 at 18:50 -0700, Matthias Kaehlcke wrote:
> El Thu, Mar 16, 2017 at 09:48:30AM -0700 Matthias Kaehlcke ha dit:
>
> > The extra pair of parantheses is not needed and causes clang to generate
> > the following warning:
> >
> > drivers/md/dm-ioctl.c:1776:11: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
> > if ((cmd == DM_DEV_CREATE_CMD)) {
> > ~~~~^~~~~~~~~~~~~~~~~~~~
> > drivers/md/dm-ioctl.c:1776:11: note: remove extraneous parentheses around the comparison to silence this warning
> > if ((cmd == DM_DEV_CREATE_CMD)) {
> > ~ ^ ~
> > drivers/md/dm-ioctl.c:1776:11: note: use '=' to turn this equality comparison into an assignment
> > if ((cmd == DM_DEV_CREATE_CMD)) {
There are dozens of these comparisons in the kernel.
Are you fixing them all or just this one?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] dm ioctl: Remove double parentheses
2017-04-01 2:07 ` Joe Perches
@ 2017-04-03 16:56 ` Matthias Kaehlcke
0 siblings, 0 replies; 4+ messages in thread
From: Matthias Kaehlcke @ 2017-04-03 16:56 UTC (permalink / raw)
To: Joe Perches
Cc: Alasdair Kergon, Mike Snitzer, dm-devel, Shaohua Li, linux-raid,
linux-kernel, Grant Grundler, Michael Davidson, Greg Hackmann
Hi Joe,
El Fri, Mar 31, 2017 at 07:07:33PM -0700 Joe Perches ha dit:
> On Fri, 2017-03-31 at 18:50 -0700, Matthias Kaehlcke wrote:
> > El Thu, Mar 16, 2017 at 09:48:30AM -0700 Matthias Kaehlcke ha dit:
> >
> > > The extra pair of parantheses is not needed and causes clang to generate
> > > the following warning:
> > >
> > > drivers/md/dm-ioctl.c:1776:11: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
> > > if ((cmd == DM_DEV_CREATE_CMD)) {
> > > ~~~~^~~~~~~~~~~~~~~~~~~~
> > > drivers/md/dm-ioctl.c:1776:11: note: remove extraneous parentheses around the comparison to silence this warning
> > > if ((cmd == DM_DEV_CREATE_CMD)) {
> > > ~ ^ ~
> > > drivers/md/dm-ioctl.c:1776:11: note: use '=' to turn this equality comparison into an assignment
> > > if ((cmd == DM_DEV_CREATE_CMD)) {
>
> There are dozens of these comparisons in the kernel.
> Are you fixing them all or just this one?
For now I focus on occurrences that pop up in my builds. So far there
have been two more:
https://patchwork.kernel.org/patch/9626833/
https://patchwork.kernel.org/patch/9631591/
Thanks
Matthias
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-03 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 16:48 [PATCH] dm ioctl: Remove double parentheses Matthias Kaehlcke
2017-04-01 1:50 ` Matthias Kaehlcke
2017-04-01 2:07 ` Joe Perches
2017-04-03 16:56 ` Matthias Kaehlcke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).