diff mbox series

btrfs: sysfs: Drop unnecessary double logical negation in acl_show()

Message ID 20240212013449.1933655-1-neal@gompa.dev (mailing list archive)
State New, archived
Headers show
Series btrfs: sysfs: Drop unnecessary double logical negation in acl_show() | expand

Commit Message

Neal Gompa Feb. 12, 2024, 1:34 a.m. UTC
The IS_ENABLED() macro already guarantees the result will be a
suitable boolean return value ("1" for enabled, and "0" for disabled).

Thus, it seems that the "!!" used right before is unnecessary, since
it is a double negation.

Dropping it should not result in any functional changes.

Signed-off-by: Neal Gompa <neal@gompa.dev>
---
 fs/btrfs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anand Jain Feb. 13, 2024, 1:28 p.m. UTC | #1
On 2/12/24 07:04, Neal Gompa wrote:
> The IS_ENABLED() macro already guarantees the result will be a
> suitable boolean return value ("1" for enabled, and "0" for disabled).
> 
> Thus, it seems that the "!!" used right before is unnecessary, since
> it is a double negation.
> 
> Dropping it should not result in any functional changes.
> 
> Signed-off-by: Neal Gompa <neal@gompa.dev>

Reviewed-by: Anand Jain <anand.jain@oracle.com>
David Sterba Feb. 13, 2024, 7:47 p.m. UTC | #2
On Sun, Feb 11, 2024 at 08:34:44PM -0500, Neal Gompa wrote:
> The IS_ENABLED() macro already guarantees the result will be a
> suitable boolean return value ("1" for enabled, and "0" for disabled).
> 
> Thus, it seems that the "!!" used right before is unnecessary, since
> it is a double negation.

Double negation is used to force 0/1 boolean values if it's from an
unknown source or value range but IS_ENABLED says it's returning 0/1 so
yeah it's not needed.

> Dropping it should not result in any functional changes.
> 
> Signed-off-by: Neal Gompa <neal@gompa.dev>

Reviewed-by: David Sterba <dsterba@suse.com>
diff mbox series

Patch

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index e6b51fb..c07a9f7 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -421,7 +421,7 @@  BTRFS_ATTR(static_feature, supported_sectorsizes,
 
 static ssize_t acl_show(struct kobject *kobj, struct kobj_attribute *a, char *buf)
 {
-	return sysfs_emit(buf, "%d\n", !!IS_ENABLED(CONFIG_BTRFS_FS_POSIX_ACL));
+	return sysfs_emit(buf, "%d\n", IS_ENABLED(CONFIG_BTRFS_FS_POSIX_ACL));
 }
 BTRFS_ATTR(static_feature, acl, acl_show);