Re: upgrading a char-driver to 2.6 cdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 16, 2005 at 08:51:02PM -0600, Jim Cromie wrote:
> folks,
> 
> Im trying to update an existing kernel char-driver to use 2.6 cdev api,
> thus far Ive failed..
> 
> Ive cut my patch down to a single, fairly bare version of scullc example 
> from LDD-3,
> which applies to drivers/char/scx200_gpio.  It compiles ok, but does 
> this when I
> access one of the pins.
> 
> Badness in kref_get at lib/kref.c:32
> [<c01b918a>] kref_get+0x2a/0x30
> [<c01b88f2>] kobject_get+0x12/0x20
> [<c014bc80>] cdev_get+0x20/0x50
> [<c014bd01>] chrdev_open+0x21/0x120
> [<c0143674>] dentry_open+0x154/0x1c0
> [<c0143510>] filp_open+0x50/0x60
> [<c0143805>] sys_open+0x35/0x70
> [<c01026f9>] syscall_call+0x7/0xb
> 
>     30 void kref_get(struct kref *kref)
>     31 {
>     32         WARN_ON(!atomic_read(&kref->refcount));
>     33         atomic_inc(&kref->refcount);
>     34 }
> 
> the object-dump tells me nothing. 

The line above with the WARN_ON() is triggering.  It's doing that
because a kref should NEVER have its reference count set to 0.  So, odds
are you never initialized your cdev properly before using it, right?

Care to post the code you wrote?

thanks,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux