mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-11 17:10:13 +00:00
dm-mpath: make dm_unregister_path_selector return void
dm_unregister_path_selector may only return error if there's a bug in the code - so we make it return void and print a warning if the user abuses this function to unregister a target that was not registered. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
parent
ebbd17695e
commit
f86272350f
@ -117,16 +117,16 @@ int dm_register_path_selector(struct path_selector_type *pst)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_register_path_selector);
|
||||
|
||||
int dm_unregister_path_selector(struct path_selector_type *pst)
|
||||
void dm_unregister_path_selector(struct path_selector_type *pst)
|
||||
{
|
||||
struct ps_internal *psi;
|
||||
|
||||
down_write(&_ps_lock);
|
||||
|
||||
psi = __find_path_selector_type(pst->name);
|
||||
if (!psi) {
|
||||
if (WARN_ON(!psi)) {
|
||||
up_write(&_ps_lock);
|
||||
return -EINVAL;
|
||||
return;
|
||||
}
|
||||
|
||||
list_del(&psi->list);
|
||||
@ -134,7 +134,5 @@ int dm_unregister_path_selector(struct path_selector_type *pst)
|
||||
up_write(&_ps_lock);
|
||||
|
||||
kfree(psi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(dm_unregister_path_selector);
|
||||
|
||||
@ -96,7 +96,7 @@ struct path_selector_type {
|
||||
int dm_register_path_selector(struct path_selector_type *type);
|
||||
|
||||
/* Unregister a path selector */
|
||||
int dm_unregister_path_selector(struct path_selector_type *type);
|
||||
void dm_unregister_path_selector(struct path_selector_type *type);
|
||||
|
||||
/* Returns a registered path selector type */
|
||||
struct path_selector_type *dm_get_path_selector(const char *name);
|
||||
|
||||
@ -551,10 +551,7 @@ static int __init dm_hst_init(void)
|
||||
|
||||
static void __exit dm_hst_exit(void)
|
||||
{
|
||||
int r = dm_unregister_path_selector(&hst_ps);
|
||||
|
||||
if (r < 0)
|
||||
DMERR("unregister failed %d", r);
|
||||
dm_unregister_path_selector(&hst_ps);
|
||||
}
|
||||
|
||||
module_init(dm_hst_init);
|
||||
|
||||
@ -260,10 +260,7 @@ static int __init dm_ioa_init(void)
|
||||
|
||||
static void __exit dm_ioa_exit(void)
|
||||
{
|
||||
int ret = dm_unregister_path_selector(&ioa_ps);
|
||||
|
||||
if (ret < 0)
|
||||
DMERR("unregister failed %d", ret);
|
||||
dm_unregister_path_selector(&ioa_ps);
|
||||
}
|
||||
|
||||
module_init(dm_ioa_init);
|
||||
|
||||
@ -270,10 +270,7 @@ static int __init dm_ql_init(void)
|
||||
|
||||
static void __exit dm_ql_exit(void)
|
||||
{
|
||||
int r = dm_unregister_path_selector(&ql_ps);
|
||||
|
||||
if (r < 0)
|
||||
DMERR("unregister failed %d", r);
|
||||
dm_unregister_path_selector(&ql_ps);
|
||||
}
|
||||
|
||||
module_init(dm_ql_init);
|
||||
|
||||
@ -230,10 +230,7 @@ static int __init dm_rr_init(void)
|
||||
|
||||
static void __exit dm_rr_exit(void)
|
||||
{
|
||||
int r = dm_unregister_path_selector(&rr_ps);
|
||||
|
||||
if (r < 0)
|
||||
DMERR("unregister failed %d", r);
|
||||
dm_unregister_path_selector(&rr_ps);
|
||||
}
|
||||
|
||||
module_init(dm_rr_init);
|
||||
|
||||
@ -351,10 +351,7 @@ static int __init dm_st_init(void)
|
||||
|
||||
static void __exit dm_st_exit(void)
|
||||
{
|
||||
int r = dm_unregister_path_selector(&st_ps);
|
||||
|
||||
if (r < 0)
|
||||
DMERR("unregister failed %d", r);
|
||||
dm_unregister_path_selector(&st_ps);
|
||||
}
|
||||
|
||||
module_init(dm_st_init);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user