lkml.org 
[lkml]   [2004]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Oops in register_chrdev, what did I do?
Date
Tommy Reynolds <Tommy.Reynolds@MegaCoder.com> writes:

> Uttered Måns Rullgård <mru@kth.se>, spake thus:
>
>> While experimenting a bit with a small kernel module, I got this
>> oops. Digging further, I found that /proc/devices had an entry saying
>> 248 <NULL>
>> which would indicate that I passed a NULL name to register_chrdev(),
>> only I didn't. I used a string constant, so I can't see what changed
>> it to NULL along the way.
>>
>> What am I missing here?
>
> Enough information for us to help you. Show us your code snippet,
> please.

I can't imagine that the details of the fops functions are a problem,
since they never get called.

static struct file_operations foo_fops = {
.owner = THIS_MODULE,
.open = foo_open,
.read = foo_read,
.write = foo_write,
.mmap = foo_mmap,
.release = foo_release
};

static int __init
init_foo(void)
{
int err;

err = register_chrdev(foo_major, "foo", &foo_fops);
if(err)
return err;

return 0;
}

static void __exit
exit_foo(void)
{
unregister_chrdev(foo_major, "foo");
}

module_init(init_foo);
module_exit(exit_foo);
MODULE_LICENSE("GPL");

--
Måns Rullgård
mru@kth.se

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.049 / U:0.520 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site