diff options
author | Andy Grover <agrover@redhat.com> | 2012-07-12 20:34:56 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-07-16 20:35:23 -0400 |
commit | 617a0c2eb316c4d3c8a67255f85c7cf676ab59a9 (patch) | |
tree | 149d634034b79212e21cedfafa10a58b45ea0f28 /drivers/target | |
parent | 2dca673b46c586d8e5dd0c8e3a582b51a1d7907d (diff) |
target: Misc retval cleanups
Bubble-up retval from iscsi_update_param_value() and
iscsit_ta_authentication().
Other very small retval cleanups.
Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_parameters.c | 2 | ||||
-rw-r--r-- | drivers/target/iscsi/iscsi_target_tpg.c | 25 |
2 files changed, 16 insertions, 11 deletions
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index ed5241e7f12a..0c4760fabfc0 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
@@ -681,7 +681,7 @@ int iscsi_update_param_value(struct iscsi_param *param, char *value) | |||
681 | param->value = kzalloc(strlen(value) + 1, GFP_KERNEL); | 681 | param->value = kzalloc(strlen(value) + 1, GFP_KERNEL); |
682 | if (!param->value) { | 682 | if (!param->value) { |
683 | pr_err("Unable to allocate memory for value.\n"); | 683 | pr_err("Unable to allocate memory for value.\n"); |
684 | return -1; | 684 | return -ENOMEM; |
685 | } | 685 | } |
686 | 686 | ||
687 | memcpy(param->value, value, strlen(value)); | 687 | memcpy(param->value, value, strlen(value)); |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index 142989598aea..a38a3f8ab0d9 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -303,6 +303,7 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg) | |||
303 | { | 303 | { |
304 | struct iscsi_param *param; | 304 | struct iscsi_param *param; |
305 | struct iscsi_tiqn *tiqn = tpg->tpg_tiqn; | 305 | struct iscsi_tiqn *tiqn = tpg->tpg_tiqn; |
306 | int ret; | ||
306 | 307 | ||
307 | spin_lock(&tpg->tpg_state_lock); | 308 | spin_lock(&tpg->tpg_state_lock); |
308 | if (tpg->tpg_state == TPG_STATE_ACTIVE) { | 309 | if (tpg->tpg_state == TPG_STATE_ACTIVE) { |
@@ -319,19 +320,19 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg) | |||
319 | param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list); | 320 | param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list); |
320 | if (!param) { | 321 | if (!param) { |
321 | spin_unlock(&tpg->tpg_state_lock); | 322 | spin_unlock(&tpg->tpg_state_lock); |
322 | return -ENOMEM; | 323 | return -EINVAL; |
323 | } | 324 | } |
324 | 325 | ||
325 | if (ISCSI_TPG_ATTRIB(tpg)->authentication) { | 326 | if (ISCSI_TPG_ATTRIB(tpg)->authentication) { |
326 | if (!strcmp(param->value, NONE)) | 327 | if (!strcmp(param->value, NONE)) { |
327 | if (iscsi_update_param_value(param, CHAP) < 0) { | 328 | ret = iscsi_update_param_value(param, CHAP); |
328 | spin_unlock(&tpg->tpg_state_lock); | 329 | if (ret) |
329 | return -ENOMEM; | 330 | goto err; |
330 | } | ||
331 | if (iscsit_ta_authentication(tpg, 1) < 0) { | ||
332 | spin_unlock(&tpg->tpg_state_lock); | ||
333 | return -ENOMEM; | ||
334 | } | 331 | } |
332 | |||
333 | ret = iscsit_ta_authentication(tpg, 1); | ||
334 | if (ret < 0) | ||
335 | goto err; | ||
335 | } | 336 | } |
336 | 337 | ||
337 | tpg->tpg_state = TPG_STATE_ACTIVE; | 338 | tpg->tpg_state = TPG_STATE_ACTIVE; |
@@ -344,6 +345,10 @@ int iscsit_tpg_enable_portal_group(struct iscsi_portal_group *tpg) | |||
344 | spin_unlock(&tiqn->tiqn_tpg_lock); | 345 | spin_unlock(&tiqn->tiqn_tpg_lock); |
345 | 346 | ||
346 | return 0; | 347 | return 0; |
348 | |||
349 | err: | ||
350 | spin_unlock(&tpg->tpg_state_lock); | ||
351 | return ret; | ||
347 | } | 352 | } |
348 | 353 | ||
349 | int iscsit_tpg_disable_portal_group(struct iscsi_portal_group *tpg, int force) | 354 | int iscsit_tpg_disable_portal_group(struct iscsi_portal_group *tpg, int force) |
@@ -558,7 +563,7 @@ int iscsit_ta_authentication(struct iscsi_portal_group *tpg, u32 authentication) | |||
558 | if ((authentication != 1) && (authentication != 0)) { | 563 | if ((authentication != 1) && (authentication != 0)) { |
559 | pr_err("Illegal value for authentication parameter:" | 564 | pr_err("Illegal value for authentication parameter:" |
560 | " %u, ignoring request.\n", authentication); | 565 | " %u, ignoring request.\n", authentication); |
561 | return -1; | 566 | return -EINVAL; |
562 | } | 567 | } |
563 | 568 | ||
564 | memset(buf1, 0, sizeof(buf1)); | 569 | memset(buf1, 0, sizeof(buf1)); |