2006-10-30 21:25:56

by Junichi Nomura

[permalink] [raw]
Subject: [PATCH 2.6.19-rc3] (2/2) clean up add_bd_holder()

Hi,

This is an additional clean-up to "[PATCH 2.6.19-rc3] (1/2)
fix bd_claim_by_kobject error handling".

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 success. But for the case 2, someone has to free
the unused struct bd_holder.
Current 2.6.19-rc3 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.

The attached patch separates the function in 2 parts to make things
clear. The patch depends on the previous fix.

Please consider to apply.

Thanks,
--
Jun'ichi Nomura, NEC Corporation of America


Attachments:
clean-up-add_bd_holder.patch (3.22 kB)