[lkml]   [2009]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectpair of alloc_disk()?

I cannot find free_disk() or similar function which takes "struct gendisk"
as a parameter and can do the reverse thing what alloc_disk() do.

Could you please give me a hint what would be the correct function call
in the following example in test_exit_module() so the module do not leak?

#include <linux/module.h>
#include <linux/genhd.h>

MODULE_AUTHOR("Márton Németh <>");
MODULE_DESCRIPTION("Test alloc_disk");

static struct gendisk *gd_ptr;

static int test_init_module(void)
printk(KERN_DEBUG "starting module\n");

gd_ptr = alloc_disk(1);
if (!gd_ptr) {
return -ENOMEM;

printk(KERN_DEBUG "gd_ptr after alloc=%p\n", gd_ptr);

return 0;

static void test_exit_module(void)
printk(KERN_DEBUG "unloading module\n");

/* FIXME: no free_disk(gd_ptr) is available */



Márton Németh
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2009-01-07 07:03    [W:0.030 / U:1.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site