Skip to contentSkip to conversation

libbpf: Remove unneeded conversion to bool

PATCH In review Thorsten Blum 2 participants 2 messages Mar 2, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: Remove unneeded conversion to bool

Fixes Coccinelle/coccicheck warning reported by boolconv.cocci.

---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index afd09571c482..2dda7a6c6f85 100644
@@ -1801,7 +1801,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
 				ext->name, value);
 			return -EINVAL;
 		}
-		*(bool *)ext_val = value == 'y' ? true : false;
+		*(bool *)ext_val = value == 'y';
 		break;
 	case KCFG_TRISTATE:
 		if (value == 'y')
Signature · 1 line
2.44.0
reviewer
#1 lore raw
Quoted 3 lines · Thorsten Blum

Fixes Coccinelle/coccicheck warning reported by boolconv.cocci.

See
https://lore.kernel.org/bpf/[email protected]/

This has been discussed multiple times and recommendation is to keep it as is.

Quoted 17 lines
---
  tools/lib/bpf/libbpf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index afd09571c482..2dda7a6c6f85 100644
@@ -1801,7 +1801,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
  				ext->name, value);
  			return -EINVAL;
  		}
-		*(bool *)ext_val = value == 'y' ? true : false;
+		*(bool *)ext_val = value == 'y';
  		break;
  	case KCFG_TRISTATE:
  		if (value == 'y')