From patchwork Wed Nov 21 10:44:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13039 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id AD04723E13 for ; Wed, 21 Nov 2012 10:50:55 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2CA41A19C4A for ; Wed, 21 Nov 2012 10:50:55 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so9595176iej.11 for ; Wed, 21 Nov 2012 02:50:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=0I1CCGIb7nzuG/RrK8+Zs6c6uqJVz18KIrqGhldeqQQ=; b=ke+DlpDEYdsie9tsZLNhhsOsZqfr1frXvBEqyjFKpSp9QlA3BoEsNWFo7mic3hIk0p 3VyBiAszuTad2Tlp8bFN3Vl6PjgUrLpxu1JSc08Wmh0LH7Ig75EVY4EbYBoS5fFelRz8 krq7BdkE3/QpKRIvKev7X4PSeAVdjhS54PiY4Y4w843ZxaWj9bUWM7cTgzCJT/CQsU4j iYNNaD/D9iz1MV6kxZm0ECw/JmPz/rTWVaR9j2sB6rLCoNLmlD/rc/NRoY8ptvXT+YTl 2fvQb3RRVjrRZNhZXElz0+l4tWk6CLW7W+OUELCi5+nN4R7x3QyZVRVhBmidZEA+Q5yr vA4w== Received: by 10.50.152.137 with SMTP id uy9mr12932298igb.62.1353495054619; Wed, 21 Nov 2012 02:50:54 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp7829igt; Wed, 21 Nov 2012 02:50:54 -0800 (PST) Received: by 10.68.251.130 with SMTP id zk2mr52130069pbc.19.1353495053628; Wed, 21 Nov 2012 02:50:53 -0800 (PST) Received: from mail-pb0-f51.google.com (mail-pb0-f51.google.com [209.85.160.51]) by mx.google.com with ESMTPS id h9si21766102pax.242.2012.11.21.02.50.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 02:50:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.51; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.51 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f51.google.com with SMTP id ro12so2708909pbb.10 for ; Wed, 21 Nov 2012 02:50:53 -0800 (PST) Received: by 10.68.197.71 with SMTP id is7mr57788683pbc.79.1353495053055; Wed, 21 Nov 2012 02:50:53 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id kb3sm55856pbc.27.2012.11.21.02.50.49 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 02:50:52 -0800 (PST) From: Sachin Kamat To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: nab@linux-iscsi.org, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 1/1] iscsi_target: Remove redundant null check before kfree Date: Wed, 21 Nov 2012 16:14:40 +0530 Message-Id: <1353494680-29476-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQn4X2Lch+Wn66eRoOX/AWljRl228VLgzrJ4n9AI5Pyezn3bEFr4Px6c7RhSqXTkzTqGDsNP kfree on null pointer is a no-op. Signed-off-by: Sachin Kamat --- 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); /*