Here's some general information on dynamic memory allocation and I/O memory access methods.
While talking about dynamic memory allocation, we should keep in mind that we're programming in the C language inside the kernel, so it's really important to remember that each allocated memory chunk must be freed up when not used anymore. This is very important because in userspace, when a process ends its execution, the kernel (which actually knows all about memory chunks owned by the process) can easily get back all process-allocated memory; but this does not hold true for the kernel. In fact, a driver (or other kernel entity) that asks for a memory chunk must be sure to free it, otherwise, nobody will ask for it back and the memory chunk will be lost until the machine is restarted.
Regarding access to I/O memory,...