Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1614355 > unrolled thread

Re: [PATCH] dm ioctl: Remove double parentheses

Started byMatthias Kaehlcke <mka@chromium.org>
First post2017-04-01 04:00 +0200
Last post2017-04-03 19:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] dm ioctl: Remove double parentheses Matthias Kaehlcke <mka@chromium.org> - 2017-04-01 04:00 +0200
    Re: [PATCH] dm ioctl: Remove double parentheses Joe Perches <joe@perches.com> - 2017-04-01 04:10 +0200
      Re: [PATCH] dm ioctl: Remove double parentheses Matthias Kaehlcke <mka@chromium.org> - 2017-04-03 19:00 +0200

#1614355 — Re: [PATCH] dm ioctl: Remove double parentheses

FromMatthias Kaehlcke <mka@chromium.org>
Date2017-04-01 04:00 +0200
SubjectRe: [PATCH] dm ioctl: Remove double parentheses
Message-ID<trguC-4hQ-7@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1614358

FromJoe Perches <joe@perches.com>
Date2017-04-01 04:10 +0200
Message-ID<trgEh-4BY-3@gated-at.bofh.it>
In reply to#1614355
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?

[toc] | [prev] | [next] | [standalone]


#1615425

FromMatthias Kaehlcke <mka@chromium.org>
Date2017-04-03 19:00 +0200
Message-ID<tsduG-YG-19@gated-at.bofh.it>
In reply to#1614358
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web