From patchwork Wed Jul 20 11:30:50 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: 9239455 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 1BB526077C for ; Wed, 20 Jul 2016 11:32:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A56A26C2F for ; Wed, 20 Jul 2016 11:32:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F176127BEE; Wed, 20 Jul 2016 11:32:38 +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 96D5826C2F for ; Wed, 20 Jul 2016 11:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753590AbcGTLca (ORCPT ); Wed, 20 Jul 2016 07:32:30 -0400 Received: from mout.web.de ([212.227.15.14]:59257 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753414AbcGTLc0 (ORCPT ); Wed, 20 Jul 2016 07:32:26 -0400 Received: from [192.168.1.2] ([77.181.180.179]) by smtp.web.de (mrweb001) with ESMTPSA (Nemesis) id 0LaTtv-1avQdd2uOF-00mMB7; Wed, 20 Jul 2016 13:31:02 +0200 Subject: [PATCH v2 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> <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> <87e55a72-71ad-d0a1-b936-12565bbc6508@users.sourceforge.net> <8806e9cb-4200-8154-7914-6735805dfbe0@users.sourceforge.net> <83b0b1e2-900b-eefc-160b-7d837730571c@suse.com> <18256bfc-c6f9-8802-8d7d-55766f0b3624@users.sourceforge.net> <85b948e0-bf37-dff0-6792-77b5dacef9a0@suse.com> <6863b12b-9095-aaf3-6140-80968e0071e2@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <62e64277-a6bc-9d9d-d80e-f3e515e7bcb3@users.sourceforge.net> Date: Wed, 20 Jul 2016 13:30:50 +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: <6863b12b-9095-aaf3-6140-80968e0071e2@users.sourceforge.net> X-Provags-ID: V03:K0:TSGnUgEg62UfFtH593p6kNsupBnrYqyBt/o/dcw7EB65IJ46VDD j+dhbi9aor+K8E4AuUJL5JSrq6OKw0Em6JG1tHX4egcr/3ArOT+X2T9cZiQNg1irgKhUlpY gCUVrqC4JTdt5Q/+gxFnRxSbZLMsocNHw9/VnFuTHG16sJ7ch6wDEOhFNiX97AGiZVtSSi3 FFiU6teSyCUcW2EKUFjtw== X-UI-Out-Filterresults: notjunk:1; V01:K0:56gFOmTWUUs=:gmUlV9BCDkYs4V2N7b+/Sd 3mk1MqDSEpkEoaea1cvAr5Rm3bamT1WnLZ55r4WJ6X49i7SBSnVbkJ4DGGIr/mBPHMvaxEgud YygigZ/VjD7CmFoVxRu7aA0K+e5lkwsvqGccWACtcP7TjujHFGM6TAawtIzYXnxfXJte/8BFf PVQbqvLZ7A6SCYOmXpydq791fKLObJUbkUQvydtrwyRuPiDLnH6k9/+DWlJ4Q6ThGgGBGF5Jy QSTQ3vjD1A0hRkahDy88FrTlazPRkFvamxXGrycd1x72a8MU1ALzjGRxxOoPoU3PQPwR5OtUh KN5PJnEV7W2x3d05DCX7FMBqU2T3dQ334flbpJDjg6kycwyFmC3vKHYB4nS5LR6ovmL170wPm 7aKp4bPsOGfk+fSJqn9CdrUj44kaeJnZltHY2FQlcnkoOYFjSQyFJcdHIGatBDXqHrIZRzVI5 fajGD6A7T9UPcTmnloXu1hJx61cX/z4EjB8XLT1H1vZ/Gl+4buxeB5u3JK6K9XHNBnh2xdM0Q YlbxVl3f/0DtWv8X0GlggmIt7CtaGwR7hTlHbeuy8MMb7At2oC6jvkPUjJkti9OS3KEy0CUfC px7DaHoQUGwnQXUYh+EadIISkiCn5t7/zZ+cQbiv2TypugxtONBK/CHp2JJwhQtLjD+8Lt+ZL ECEc7bCMgc/3kpHUSk1dHtpoh77q2GwspBubeMqwcLgzEkKLSuWH+TpE4dQSo6SI/MQgQkvTE JJ9K4MSoBnSsglwBAgPx6cLsGnMvyuTz3RK3iL+o/4P8yS6dLCgqrgVbbPCGzSjNnk/ESlIL9 oi2MlqO 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: Tue, 19 Jul 2016 15:42:19 +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 --- v2: Rebased on source files from "Linux next-20160719" 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); }