[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: alloc_chrdev_region/unregister_chrdev_region - Issue
On Mon, Dec 8, 2008 at 7:45 PM, Chetan Nanda <chetannanda@xxxxxxxxx> wrote:
> Hi,
>
> I am using 'alloc_chrdev_region' for registering char device range and then
> 'unregister_chrdev_region' for un-registering it.
> But on each insmod I am getting MAJOR number as one less then that of
> previous time.
/* temporary */
96 if (major == 0) {
97 for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
98 if (chrdevs[i] == NULL)
99 break;
100 }
101
102 if (i == 0) {
103 ret = -EBUSY;
104 goto out;
105 }
106 major = i;
107 ret = major;
108 }
109
REF: http://lxr.oss.org.cn/source/fs/char_dev.c#L80
>
> On seeing the code (unregister_chrdev_region) it seems that it just kfree
> the chrdevs[] entry but not set it to NULL which cause for new
> entry in chrdevs[].
>
Thats right, it is like that.
Dont have much idea regarding the same. I think we should assign a
NULL to it for sure.
> Thanks,
> Chetan Nanda
>
--
Regards,
Sandeep.
"To learn is to change. Education is a process that changes the learner."
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ