Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp468071ybe; Wed, 4 Sep 2019 02:39:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYxhHUa4wQkDKMRDSJt7xBwJUyOZrPlP/w9jnETbSW67SrPhZbgCSYOo813uWT0yjRtLcN X-Received: by 2002:a63:cb4f:: with SMTP id m15mr34043035pgi.100.1567589961891; Wed, 04 Sep 2019 02:39:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567589961; cv=none; d=google.com; s=arc-20160816; b=hd2ylZGpSK6LJq+8trl/TlcxNketLDi/5pQG2XrZ4P3FVbjgSxH3iQmaE198VIPR3q /E7yM1aB6QgLINo3Gs4KPBbFZjR1SS0p3QvtK5l8Bpph5KapxlSbT/GBLhLjbeV0VN5y a2J+o0bU9H4mbi+ohYloyAToKAxYLwYv3uMZLthGOjUHUWjAR/EEMMau2vXFKI//V3Pw FuV2Ra7DLCX8giXOSw/d5xWynY0oPm6i1rJ2X8qNu3hnPCy83urMRkq8hYp9eWbHBZNq 1hUe1RD9u7xg7+5S7JTrv6AVQVVERsXN1+AaPsTF/BPVSLSUi40KuNkBKv9CbZk887iQ gleg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=LRaokk/VUNh9mW2B6GwBCyNYxAGOC8MHRjG9pWYup50=; b=Z+M9wqKk5ZBoFwGY9zbx5xdqiW5y9GvgjmAD6Jmwd8S+meg91PKr6r4xnnvUkjyY8K bdIGGntwlgn1Kp7iWTuRpGf4Z2spVg54Q5aEzvo780P8I8SsDVP0Fvo20KCMgN4T0WU4 udGt6irnxr+OJZkJsWyKhXGJWxvwTeYt/aMhb3p6QEezkrkRTqQHhUf2mPTbD7dyOGw/ lUAJnCuHf20R5Tg3u9ZH19cb5FyXMB3bZ3w6Vpx1gMW4mtdha5B+y2YG590KZPHHkKAe WhBFiWnR1Lvwms5Xvj2+Rw+DtuQFi3N3jjVwKlm3mdEyTLe5bZd8XaTUVUEyJckLmwEq P8LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-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 14si9620065pfj.37.2019.09.04.02.38.59; Wed, 04 Sep 2019 02:39:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729475AbfIDJiV (ORCPT + 99 others); Wed, 4 Sep 2019 05:38:21 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5755 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726045AbfIDJiV (ORCPT ); Wed, 4 Sep 2019 05:38:21 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 86C12F2FF5C3E59212E6; Wed, 4 Sep 2019 17:38:19 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Wed, 4 Sep 2019 17:38:15 +0800 Message-ID: <5D6F8606.8030109@huawei.com> Date: Wed, 4 Sep 2019 17:38:14 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Joerg Roedel CC: , , , , , , Subject: Re: [PATCH 2/3] iommu/pamu: Use kzfree rather than its implementation References: <1567566079-7412-1-git-send-email-zhongjiang@huawei.com> <1567566079-7412-3-git-send-email-zhongjiang@huawei.com> <20190904081517.GA29855@8bytes.org> In-Reply-To: <20190904081517.GA29855@8bytes.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2019/9/4 16:15, Joerg Roedel wrote: > On Wed, Sep 04, 2019 at 11:01:18AM +0800, zhong jiang wrote: >> Use kzfree instead of memset() + kfree(). >> >> Signed-off-by: zhong jiang >> --- >> drivers/iommu/fsl_pamu.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c >> index cde281b..ca6d147 100644 >> --- a/drivers/iommu/fsl_pamu.c >> +++ b/drivers/iommu/fsl_pamu.c >> @@ -1174,10 +1174,8 @@ static int fsl_pamu_probe(struct platform_device *pdev) >> if (irq != NO_IRQ) >> free_irq(irq, data); >> >> - if (data) { >> - memset(data, 0, sizeof(struct pamu_isr_data)); >> - kfree(data); >> - } >> + if (data) >> + kzfree(data); > kzfree() is doing its own NULL-ptr check, no need to do it here. Yep, we should also remove the condition before kzfree. will repost. Thanks, zhong jiang > Regards, > > Joerg