[PATCH net-next v2] net: Use str_yes_no() helper function
From: Thorsten Blum
Date: Sat Oct 26 2024 - 11:33:38 EST
Remove hard-coded strings by using the str_yes_no() helper function.
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
Changes in v2:
- Use str_yes_no() instead of str_no_yes() as suggested by Willem de Bruijn
- Link to v1: https://lore.kernel.org/r/20241026112946.129310-2-thorsten.blum@xxxxxxxxx/
---
net/core/sock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 039be95c40cf..f753f87d0715 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -4140,7 +4140,7 @@ static long sock_prot_memory_allocated(struct proto *proto)
static const char *sock_prot_memory_pressure(struct proto *proto)
{
return proto->memory_pressure != NULL ?
- proto_memory_pressure(proto) ? "yes" : "no" : "NI";
+ str_yes_no(proto_memory_pressure(proto)) : "NI";
}
static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
@@ -4154,7 +4154,7 @@ static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
sock_prot_memory_allocated(proto),
sock_prot_memory_pressure(proto),
proto->max_header,
- proto->slab == NULL ? "no" : "yes",
+ str_yes_no(proto->slab),
module_name(proto->owner),
proto_method_implemented(proto->close),
proto_method_implemented(proto->connect),
--
2.47.0