diff mbox

[1/1] iscsi_target: Remove redundant null check before kfree

Message ID 1353494680-29476-1-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 21, 2012, 10:44 a.m. UTC
kfree on null pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/target/iscsi/iscsi_target_login.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Comments

Nicholas A. Bellinger Nov. 28, 2012, 2:51 a.m. UTC | #1
Hi Sachin,

On Wed, 2012-11-21 at 16:14 +0530, Sachin Kamat wrote:
> kfree on null pointer is a no-op.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---

Apologies for the delayed response.  Applied to target-pending/for-next.

Thank you!

--nab

>  drivers/target/iscsi/iscsi_target_login.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
> index 7bf9ccc..fdb632f 100644
> --- a/drivers/target/iscsi/iscsi_target_login.c
> +++ b/drivers/target/iscsi/iscsi_target_login.c
> @@ -1118,10 +1118,8 @@ new_sess_out:
>  		idr_remove(&sess_idr, conn->sess->session_index);
>  		spin_unlock_bh(&sess_idr_lock);
>  	}
> -	if (conn->sess->sess_ops)
> -		kfree(conn->sess->sess_ops);
> -	if (conn->sess)
> -		kfree(conn->sess);
> +	kfree(conn->sess->sess_ops);
> +	kfree(conn->sess);
>  old_sess_out:
>  	iscsi_stop_login_thread_timer(np);
>  	/*
diff mbox

Patch

diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
index 7bf9ccc..fdb632f 100644
--- a/drivers/target/iscsi/iscsi_target_login.c
+++ b/drivers/target/iscsi/iscsi_target_login.c
@@ -1118,10 +1118,8 @@  new_sess_out:
 		idr_remove(&sess_idr, conn->sess->session_index);
 		spin_unlock_bh(&sess_idr_lock);
 	}
-	if (conn->sess->sess_ops)
-		kfree(conn->sess->sess_ops);
-	if (conn->sess)
-		kfree(conn->sess);
+	kfree(conn->sess->sess_ops);
+	kfree(conn->sess);
 old_sess_out:
 	iscsi_stop_login_thread_timer(np);
 	/*