Skip to contentSkip to conversation

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

PATCH In review Neal Gompa 3 participants 3 messages Feb 12, 2024 – Feb 13, 2024 Btrfs file system

lore
Share & tools
lore

Neal Gompa

author
#0 lore raw

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

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.

---
 fs/btrfs/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/sysfs.c +1 -1
index e6b51fb..c07a9f7 100644
@@ -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);
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Neal Gompa

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.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Neal Gompa
Quoted 5 lines · Neal Gompa

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.

Quoted 3 lines

Dropping it should not result in any functional changes.