The iscsit_setup_np() invocation can be moved out into the single caller. Signed-off-by: David Disseldorp <ddiss@xxxxxxx> --- drivers/target/iscsi/iscsi_target.c | 7 +++++-- drivers/target/iscsi/iscsi_target_login.c | 15 --------------- drivers/target/iscsi/iscsi_target_login.h | 2 -- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index dc0110c..6b78061 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c @@ -461,16 +461,19 @@ int iscsit_enable_np_thread( spin_unlock_bh(&np->np_thread_lock); return 0; } - ret = iscsi_target_setup_login_socket(np, &np->np_sockaddr); - if (ret != 0) { + + ret = np->np_transport->iscsit_setup_np(np, &np->np_sockaddr); + if (ret < 0) { spin_unlock_bh(&np->np_thread_lock); return ret; } + np->enabled = true; spin_unlock_bh(&np->np_thread_lock); np->np_thread = kthread_run(iscsi_target_login_thread, np, "iscsi_np"); if (IS_ERR(np->np_thread)) { + np->enabled = false; np->np_transport->iscsit_free_np(np); pr_err("Unable to create kthread: iscsi_np\n"); ret = PTR_ERR(np->np_thread); diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 6c1cd2e..871facb 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c @@ -968,21 +968,6 @@ fail: return ret; } -int iscsi_target_setup_login_socket( - struct iscsi_np *np, - struct __kernel_sockaddr_storage *sockaddr) -{ - int rc; - - rc = np->np_transport->iscsit_setup_np(np, &np->np_sockaddr); - if (rc < 0) { - return rc; - } - - np->enabled = true; - return 0; -} - int iscsit_accept_np(struct iscsi_np *np, struct iscsi_conn *conn) { struct socket *new_sock, *sock = np->np_socket; diff --git a/drivers/target/iscsi/iscsi_target_login.h b/drivers/target/iscsi/iscsi_target_login.h index 1c73580..7a58fff 100644 --- a/drivers/target/iscsi/iscsi_target_login.h +++ b/drivers/target/iscsi/iscsi_target_login.h @@ -6,8 +6,6 @@ extern int iscsi_check_for_session_reinstatement(struct iscsi_conn *); extern int iscsi_login_post_auth_non_zero_tsih(struct iscsi_conn *, u16, u32); extern int iscsit_setup_np(struct iscsi_np *, struct __kernel_sockaddr_storage *); -extern int iscsi_target_setup_login_socket(struct iscsi_np *, - struct __kernel_sockaddr_storage *); extern int iscsit_accept_np(struct iscsi_np *, struct iscsi_conn *); extern int iscsit_get_login_rx(struct iscsi_conn *, struct iscsi_login *); extern int iscsit_put_login_tx(struct iscsi_conn *, struct iscsi_login *, u32); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html