04. kfree 釋放記憶體

04. kfree 釋放記憶體

void memory_exit(void) {
  /* Freeing the major number */
  unregister_chrdev(memory_major, "memory");

  /* Freeing buffer memory */
  if (memory_buffer) {
    kfree(memory_buffer);
  }

  printk("<1>Removing memory module\n");

}

Linux Driver
CH01 簡介CH02 註冊CH03 記憶體CH04 硬體函數CH05 USB