https://github.com/torvalds/linux
Revision df6c0cd9a872ebf2298f5d66d8c789f62dbe35fc authored by Jun'ichi Nomura on 30 October 2006, 21:23:56 UTC, committed by Linus Torvalds on 31 October 2006, 03:29:41 UTC
add_bd_holder() is called from bd_claim_by_kobject to put a given struct
bd_holder in the list if there is no matching entry.

There are 3 possible results of add_bd_holder():
  1. there is no matching entry and add the given one to the list
  2. there is matching entry, so just increment reference count of
     the existing one
  3. something failed during its course

1 and 2 are successful cases.  But for case 2, someone has to free the
unused struct bd_holder.

The current code frees it inside of add_bd_holder and returns same value
0 for both cases 1 and 2.  However, it's natural and less error-prone if
caller frees it since it's allocated by the caller.

Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent bcb5516
History
Tip revision: df6c0cd9a872ebf2298f5d66d8c789f62dbe35fc authored by Jun'ichi Nomura on 30 October 2006, 21:23:56 UTC
[PATCH] clean up add_bd_holder()
Tip revision: df6c0cd
File Mode Size
Documentation
arch
block
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
scripts
security
sound
usr
.gitignore -rw-r--r-- 542 bytes
COPYING -rw-r--r-- 18.3 KB
CREDITS -rw-r--r-- 88.2 KB
Kbuild -rw-r--r-- 1.2 KB
MAINTAINERS -rw-r--r-- 73.8 KB
Makefile -rw-r--r-- 49.0 KB
README -rw-r--r-- 16.2 KB
REPORTING-BUGS -rw-r--r-- 3.0 KB

README

back to top