2022-04-26 08:06:20

by Ian Cowan

[permalink] [raw]
Subject: [PATCH v2] staging: fieldbus: remove unnecessary double negation

The values that are being double negated in this case are booleans to begin
with, so the double negation has no effect on the result.

Signed-off-by: Ian Cowan <[email protected]>
---
drivers/staging/fieldbus/dev_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
index 5aab734606ea..6766b2b13482 100644
--- a/drivers/staging/fieldbus/dev_core.c
+++ b/drivers/staging/fieldbus/dev_core.c
@@ -28,7 +28,7 @@ static ssize_t online_show(struct device *dev, struct device_attribute *attr,
{
struct fieldbus_dev *fb = dev_get_drvdata(dev);

- return sprintf(buf, "%d\n", !!fb->online);
+ return sprintf(buf, "%d\n", fb->online);
}
static DEVICE_ATTR_RO(online);

@@ -39,7 +39,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,

if (!fb->enable_get)
return -EINVAL;
- return sprintf(buf, "%d\n", !!fb->enable_get(fb));
+ return sprintf(buf, "%d\n", fb->enable_get(fb));
}

static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
--
2.35.1


2022-04-26 13:20:09

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2] staging: fieldbus: remove unnecessary double negation

On Mon, Apr 25, 2022 at 06:25:26PM -0400, Ian Cowan wrote:
> The values that are being double negated in this case are booleans to begin
> with, so the double negation has no effect on the result.
>
> Signed-off-by: Ian Cowan <[email protected]>
> ---
> drivers/staging/fieldbus/dev_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c
> index 5aab734606ea..6766b2b13482 100644
> --- a/drivers/staging/fieldbus/dev_core.c
> +++ b/drivers/staging/fieldbus/dev_core.c
> @@ -28,7 +28,7 @@ static ssize_t online_show(struct device *dev, struct device_attribute *attr,
> {
> struct fieldbus_dev *fb = dev_get_drvdata(dev);
>
> - return sprintf(buf, "%d\n", !!fb->online);
> + return sprintf(buf, "%d\n", fb->online);
> }
> static DEVICE_ATTR_RO(online);
>
> @@ -39,7 +39,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
>
> if (!fb->enable_get)
> return -EINVAL;
> - return sprintf(buf, "%d\n", !!fb->enable_get(fb));
> + return sprintf(buf, "%d\n", fb->enable_get(fb));
> }
>
> static ssize_t enabled_store(struct device *dev, struct device_attribute *attr,
> --
> 2.35.1
>
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/SubmittingPatches for what needs to be done
here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot