Re: request_region checks.

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

 



Hi Mark

>  I've been looking through some of the device drivers and find quite often a call
>  to request_region of the form:
>
>         if (!request_region(IO_INDEX_PORT, 2, WATCHDOG_NAME))
>         {
>                 printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
>                         IO_INDEX_PORT);
>                 rc = -EIO;
>                 goto err_out;
>         }
>
>  I was interested in finding out what happens to the pointer which is returned
>  from request_region. This if statement simply interests itself with the case of
>  request_region returning NULL and makes no consideration that a pointer
>  may be returned.

The point is that with "request_region" the region you requested is internally
inserted in a linked list. So you are not supposed to free the memory,
unless it is removed again from that list. And this is done by the
"release_region" macro implicitly (removed from the list and the memory
released).

Hope this makes it a bit clearer.
Arvin

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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