Skip to contentSkip to conversation

mm: use __func__ replace function name

PATCH In review hui yang 2 participants 2 messages Jun 15, 2020

Subsystems (2)
lore
Share & tools
lore

hui yang

author
#0 lore raw

PATCH 1/1 mm: use __func__ replace function name

From: YangHui <[email protected]>

it's much better to use __func__

---
 mm/slab_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/slab_common.c +2 -2
index 9e72ba2..274b374 100644
@@ -960,8 +960,8 @@ void kmem_cache_destroy(struct kmem_cache *s)
 		err = shutdown_cache(s);
 
 	if (err) {
-		pr_err("kmem_cache_destroy %s: Slab cache still has objects\n",
-		       s->name);
+		pr_err("%s: %s: Slab cache still has objects\n",
+		       __func__, s->name);
 		dump_stack();
 	}
 out_unlock:
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · hui yang

From: YangHui <[email protected]>

it's much better to use __func__

Not always. This message is reporting the improper usage of a public API. If we were to, for example, split the function into two and rename this half of it __kmem_cache_destroy(), we'd still want this message to say kmem_cache_destroy.

I don't think we should apply this change, and if you have similar patches in mind, I'd like to see a more detailed argument than "it's better".

Quoted 11 lines
mm/slab_common.c +2 -2
@@ -960,8 +960,8 @@ void kmem_cache_destroy(struct kmem_cache *s)
 		err = shutdown_cache(s);
 
 	if (err) {
-		pr_err("kmem_cache_destroy %s: Slab cache still has objects\n",
-		       s->name);
+		pr_err("%s: %s: Slab cache still has objects\n",
+		       __func__, s->name);
 		dump_stack();
 	}
 out_unlock: