From patchwork Sat Jul 16 20:22:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9233369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 777D760865 for ; Sat, 16 Jul 2016 20:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5599C212D8 for ; Sat, 16 Jul 2016 20:22:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 369AF212DB; Sat, 16 Jul 2016 20:22:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5EA9212D8 for ; Sat, 16 Jul 2016 20:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751814AbcGPUWr (ORCPT ); Sat, 16 Jul 2016 16:22:47 -0400 Received: from mout.web.de ([217.72.192.78]:51547 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbcGPUWq (ORCPT ); Sat, 16 Jul 2016 16:22:46 -0400 Received: from [192.168.1.2] ([77.182.189.163]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0M5fsK-1b92Yn3J6m-00xf8l; Sat, 16 Jul 2016 22:22:29 +0200 Subject: [PATCH 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" To: xen-devel@lists.xenproject.org, linux-scsi@vger.kernel.org, =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= , David Vrabel , Boris Ostrovsky References: <5307CAA2.8060406@users.sourceforge.net> <530A086E.8010901@users.sourceforge.net> <530A72AA.3000601@users.sourceforge.net> <530B5FB6.6010207@users.sourceforge.net> <530C5E18.1020800@users.sourceforge.net> <530CD2C4.4050903@users.sourceforge.net> <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <59e51c7d-f7bb-c55f-d2fe-06dccfef6a99@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: Date: Sat, 16 Jul 2016 22:22:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <59e51c7d-f7bb-c55f-d2fe-06dccfef6a99@users.sourceforge.net> X-Provags-ID: V03:K0:EbYy4fCF/GbyHtZDNV+23j7Z2gU+iuOjfjOf6Ql+qiOD1bquWsp QW/uMI5zSMiMJGIlqNgUQAbPTAcWaUxTRTyEkb5nhYYKIWNTq6dPvUKHPIZU3BnIR/sd29h NQ8q/09dFaTVTJdU5oyPwdnK7yHdPR2KVzUb0KKKVLo+SXAZMXYpPgxxkjKeUxQeCyiJDfk 2ZjG2qqUUvzgveagXUDuA== X-UI-Out-Filterresults: notjunk:1; V01:K0:/dFBsphdOU4=:GM5g8kbK8HrYfiK+SVzeAP 0Lj41LXeV8PMbqFML9srB0jVr+/VOLMXG3ARILRT0wkAn/XLfZVX5VgTtMgjyUs66g2XK7RiD KADr4bTcwu/jm32tboxGd1NLzyEQXQIDpkEMo8pLgqgdGSNntq1kf7Y7Q/IzpRKfeGTFf25S9 nt4ROpfr9L6vNj6NgQ9qL48hA89DqG0gECHZlfPcYjZluisOkPp4huNAm29qmBZbmcA8Zr9ET bF1yCCr8OO8ZYSn4YZ1Rf/FVbuvOpAhz/Q1C9AJp4IMUkpF1omTQtoCh/K1o2EalvBAJIDbJx klAO/nR/mDBOp4yuDUkUg6P11dq6CyynOAC9d9bYROeCOcFBG4+SDqh2KI1zfRS5TepAQ2bjv ZTS1+zjLGirBGjGPfvP4YdXaw0wR9FFSPkLf7TAo3zsF8HvB3r/n5hDeFKm513im8j78GkXBS hjpmWdgd010b1+nzh1xZTZfxwLn2DozWLED7FahGrd1mYbEBI+CIC42WmS0fskXIRWN5Ko00L CrApi2sdBd12+BowcK7pz+ftk22qkZ69YiNLFTa6mTXGaYdOgUYG7NueX2fA1+B+sWcTWoULL +sDI9pdy1M8iUSP6aviuueofcvWbaNwDQsF+m5GWj16eCp/ZvFb1SXYiveUf2Xfc/ZoU/vKia NHEHmjodumFFf2HgbWaYwbU3apCETl3jsH2LSQIrxY/kWSGLGPlnLbJp2a178BbF0vM8yrUfH c7kwFdpTQEvzLqVrW2sMqJGI73kwISgX8uIA9qZFFHRIcXd4eCsZAki/GdVdgWahdVGhM4Taf r4aubXd Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 16 Jul 2016 21:21:05 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring Reviewed-by: Juergen Gross --- drivers/xen/xen-scsiback.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c index d6950e0..4a48c06 100644 --- a/drivers/xen/xen-scsiback.c +++ b/drivers/xen/xen-scsiback.c @@ -627,8 +627,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, transport_generic_free_cmd(&pending_req->se_cmd, 1); return; err: - if (tmr) - kfree(tmr); + kfree(tmr); scsiback_do_resp_with_sense(NULL, err, 0, pending_req); }