public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mru@kth.se>
To: linux-kernel@vger.kernel.org
Subject: Re: Oops in register_chrdev, what did I do?
Date: Mon, 02 Aug 2004 10:15:05 +0200	[thread overview]
Message-ID: <yw1xzn5eyn06.fsf@kth.se> (raw)
In-Reply-To: 20040801200919.5da16bc7.Tommy.Reynolds@MegaCoder.com

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


  reply	other threads:[~2004-08-02  8:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-01 20:01 Oops in register_chrdev, what did I do? Måns Rullgård
2004-08-02  1:09 ` Tommy Reynolds
2004-08-02  8:15   ` Måns Rullgård [this message]
2004-08-02  9:36 ` Måns Rullgård
2004-08-02  9:39   ` Arjan van de Ven
2004-08-02 10:09     ` Måns Rullgård
2004-08-02 10:10       ` Arjan van de Ven
2004-08-02 12:53         ` Måns Rullgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yw1xzn5eyn06.fsf@kth.se \
    --to=mru@kth.se \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox