Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp686178imm; Fri, 21 Sep 2018 06:43:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZuIVp2mb+hfpRn0QjNs62gbB7cWoy1taT2eXaHKcgCrxYlEga/PwrE1fPyXpG/fyVOsNE9 X-Received: by 2002:a17:902:d216:: with SMTP id t22-v6mr7041619ply.338.1537537422698; Fri, 21 Sep 2018 06:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537422; cv=none; d=google.com; s=arc-20160816; b=qus3gvSYZ1OSApaL/EbQuQxGXiJEd7snJLAXH2Mixqiy8PbxxD/ZL75ZsR74DLo0C3 40U/y3H/zY8tGqaY0oD8gNDN/5SevzmQeoAH5mXpVCG6LzJZGIL8DvYbWvj1JQsjkqlL gAurIWO/h4vDuBuKegw0v78n3gs+DwLFE470PE3Vg9z4LysjUb/l84VTCY7lzwFWgALn Y+25NpPiE0Wyg1ED1LAYsNfA2abekOLxyx6FcLgry9FuXg+ebsivCWU+iKh05wgwRJ/3 MGTQ0LDJrXkGOsUs91RSqfrO5nTIOwaD8yyzPfxpmsdHBmxRQ+KlbVtcfnMOXCBbPP3C JDKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=X/TCbe4P2R6iBhOvToFrx34rIoChe+J/yTMkjfmItmU=; b=juWZtjiGToX5yHXHlbhSF12RZ/c43qsMxTweXxh54eD1p3DKUBdwtKnXpgqyVnUsAE bKIUtrgnWrC4pP0f2io1zCz7fKmX68SAfrfAE0rECBEB7nQH6xQPscSgTHRtZ86PneuJ 1qEQCwq+vzigX9iRDEKCOYGpeufXXavQpnxzN8CV41XdXdzZHC84gnPgQm6Yx5y8EmXo +0D0YyStmruU7mPYRAPjldesjIIJx68b7ieHbvO5i97AiDTa/TmmlduyISm6ECDouKBU Xu/Fu1lQsDebCvoROdSShAaUP6ABdpPd0Pv38tyCjX3QZTJIKP20/mXrFVV272TKcngf YSWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m86-v6si28751621pfj.48.2018.09.21.06.43.26; Fri, 21 Sep 2018 06:43:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390511AbeIUTbj (ORCPT + 99 others); Fri, 21 Sep 2018 15:31:39 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:45167 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389581AbeIUTbg (ORCPT ); Fri, 21 Sep 2018 15:31:36 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B8E074F85401F; Fri, 21 Sep 2018 21:42:37 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.399.0; Fri, 21 Sep 2018 21:42:38 +0800 From: zhong jiang To: , CC: , , Subject: [PATCH] crypto: cavium: remove redundant null pointer check before kfree Date: Fri, 21 Sep 2018 21:30:15 +0800 Message-ID: <1537536615-46814-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kfree has taken the null pointer into account. hence it is safe to remove the redundant null pointer check before kfree. Signed-off-by: zhong jiang --- drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c index b0ba433..ca549c5 100644 --- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c +++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c @@ -308,21 +308,11 @@ void do_request_cleanup(struct cpt_vf *cptvf, } } - if (info->scatter_components) - kzfree(info->scatter_components); - - if (info->gather_components) - kzfree(info->gather_components); - - if (info->out_buffer) - kzfree(info->out_buffer); - - if (info->in_buffer) - kzfree(info->in_buffer); - - if (info->completion_addr) - kzfree((void *)info->completion_addr); - + kzfree(info->scatter_components); + kzfree(info->gather_components); + kzfree(info->out_buffer); + kzfree(info->in_buffer); + kzfree((void *)info->completion_addr); kzfree(info); } -- 1.7.12.4