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: 9239459 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 7452A6077C for ; Wed, 20 Jul 2016 11:33:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6503C26C2F for ; Wed, 20 Jul 2016 11:33:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58E7227B81; Wed, 20 Jul 2016 11:33:33 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D40E026C2F for ; Wed, 20 Jul 2016 11:33:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPpiX-0002Ba-LD; Wed, 20 Jul 2016 11:31:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPpiW-0002BT-Fz for xen-devel@lists.xenproject.org; Wed, 20 Jul 2016 11:31:08 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 59/AB-03281-BF06F875; Wed, 20 Jul 2016 11:31:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsVy5TE/n+7vhP5 wg9X7GC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owXR96xFixkr3h28BpzA+NSti5GLg4hgfmM EtOv72LtYuTkEBZIlug4epQJJCEicJpRYveHx8wQVT/ZJX7u7WAGqWIWyJOYe+AZO4jNJmAu0 bv2M0sXIwcHr4CHROMVQ5Awi4CqxOlT78FKRAVCJVa8OcEGYvMKCEqcnPmEBcTmFPCUeD/pPN RIPYkd13+xQtjyEtvfzgHbKyHwmVFiWftHFginj12iaf1n1gmM/LOQDJuFZMAsJAMWMDKvYtQ oTi0qSy3SNTTXSyrKTM8oyU3MzNE1NDDWy00tLk5MT81JTCrWS87P3cQIDEYGINjB+PK05yFG SQ4mJVFeVdHecCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvJzA4BYSLEpNT61Iy8wBxgVMWoKDR 0mE1wYkzVtckJhbnJkOkTrFqMux4MfttUxCLHn5ealS4rzz44GKBECKMkrz4EbAYvQSo6yUMC 8j0FFCPAWpRbmZJajyrxjFORiVhHlNQVbxZOaVwG16BXQEE9ARcwTAjihJREhJNTDO3n73V6/ crO3LJ37rumn8ao+T4fH3lmeM/zFl8Vx+cePW+bbJxQFxJ0qnTvYwt+1a8LPi+RNZEeZT14wV rtz1nRe75eVvBYYTBpefbNmWKf5Z4qrLulmB97p1g09tDHFexbQkRnTK7RldqYsuMYqXrbttJ WjlrnEwsdJ/+87Ku1NLpZZnilnxKLEUZyQaajEXFScCAGhBmgHMAgAA X-Env-Sender: elfring@users.sourceforge.net X-Msg-Ref: server-11.tower-31.messagelabs.com!1469014266!25277552!1 X-Originating-IP: [212.227.15.14] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29565 invoked from network); 20 Jul 2016 11:31:07 -0000 Received: from mout.web.de (HELO mout.web.de) (212.227.15.14) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Jul 2016 11:31:07 -0000 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 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> 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 Cc: Julia Lawall , kernel-janitors@vger.kernel.org, LKML Subject: [Xen-devel] [PATCH v2 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree" X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 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); }