Re: Oops in register_chrdev, what did I do?

From: Måns Rullgård
Date: Mon Aug 02 2004 - 03:17:00 EST


Tommy Reynolds <Tommy.Reynolds@xxxxxxxxxxxxx> writes:

> Uttered Måns Rullgård <mru@xxxxxx>, 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@xxxxxx

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