More explicit handling of error conditions is also good FWIW - don't see you doing it here. The kernel is not forgiving of using resources your don't have or failing to free resources acquired.
kernel newbies is theoretically a good place to go with these kinds of questions too.