Skip to contentSkip to conversation

slab: Use %s instead of function name

PATCH Superseded gumingtao 2 participants 3 messages Jun 21, 2021 – Jun 22, 2021

Subsystems (2)
lore
Share & tools
lore

gumingtao

author
#0 lore raw

PATCH v2 1/1 slab: Use %s instead of function name

Changes in v2
- use %s replace function name for the panic() call
- use %s replace function name:kmem_cache_destroy

gumingtao (1):
slab: Use %s instead of function name

 mm/slab_common.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/1 slab: Use %s instead of function name

It is better to replace the function name with %s.

---
 mm/slab_common.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
mm/slab_common.c +6 -6
index a4a5714..ffa3b11 100644
@@ -378,11 +378,11 @@ kmem_cache_create_usercopy(const char *name,
 
 	if (err) {
 		if (flags & SLAB_PANIC)
-			panic("kmem_cache_create: Failed to create slab '%s'. Error %d\n",
-				name, err);
+			panic("%s: Failed to create slab '%s'. Error %d\n",
+				__func__, name, err);
 		else {
-			pr_warn("kmem_cache_create(%s) failed with error %d\n",
-				name, err);
+			pr_warn("%s(%s) failed with error %d\n",
+				__func__, name, err);
 			dump_stack();
 		}
 		return NULL;
@@ -509,8 +509,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
#2 lore raw

From: gumingtao

Quoted 3 lines

Sent: 21 June 2021 03:41

It is better to replace the function name with %s.

Should this (and the subject) be:

Use __func__ to trace function names.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)