8000 do correct return from init · ymm238/Linux-Kernel-Programming@83ad4dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 83ad4dc

Browse files
committed
do correct return from init
1 parent 275cf18 commit 83ad4dc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

ch9/slab_custom/slab_custom.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static int use_our_cache(void)
6161

6262
obj = kmem_cache_alloc(gctx_cachep, GFP_KERNEL);
6363
if (!obj) { /* pedantic warning printk below... */
64-
pr_warn("kmem_cache_alloc() failed\n");
64+
pr_warn("[Pedantic] kmem_cache_alloc() failed\n");
6565
return -ENOMEM;
6666
}
6767

@@ -84,8 +84,8 @@ static void our_ctor(void *new)
8484
struct task_struct *p = current;
8585

8686
/* TIP: to see how exactly we got here, insert this call:
87-
* dump_stack();
88-
* (read it bottom-up ignoring call frames that begin with '?')
87+
* dump_stack();
88+
* (read it bottom-up ignoring call frames that begin with '?')
8989
*/
9090
pr_info("in ctor: just alloced mem object is @ 0x%px\n", ctx); /* %pK in production */
9191
memset(ctx, 0, sizeof(struct myctx));
@@ -137,8 +137,7 @@ static int __init slab_custom_init(void)
137137
{
138138
pr_info("inserted\n");
139139
create_our_cache();
140-
use_our_cache();
141-
return 0; /* success */
140+
return use_our_cache();
142141
}
143142

144143
static void __exit slab_custom_exit(void)

0 commit comments

Comments
 (0)
0