Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp398355ybe; Wed, 4 Sep 2019 01:15:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi1qZYsPeVt6n4WmL+Cyr/A2tS6btAwEJOFundftmo81JockQfmbOTPmc4bHtied4TDI9N X-Received: by 2002:a17:90a:8b98:: with SMTP id z24mr3707951pjn.77.1567584952126; Wed, 04 Sep 2019 01:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567584952; cv=none; d=google.com; s=arc-20160816; b=NHhbI93SbJpOarEHUVzBiIwpytwgY3E+0UD7GC49N9IWOKDEsM23V5MzZcf39pyXDv QfjLi7DdJgKFZGLpzo0JnnkLBbzImRJ4DCW0BLS+k84kI9Gx/2F56H6sk1gUuN/l1bWy e+wUsAr+KXtVCn1K0V+8xyMp1rhP84BQ3w+8Z3Zm/+Or52DaCaXqPXhmFCqORW8ERU33 M2GDsWeEx8qRi9A9LTKSZYvXfqGzRU9cmnMXNwWZ+gnTMeYHIewLgD+PKn+e/Z3RtAeD McoR6DQHsI8nvKNbFvIHyBNHebsAXo4uaNYLx1ys/ntjmG/M7Z19rTjiHCs4498T6pB2 8qbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=xRR7iu2j93iWYeuGcYps8fS6TytyQ058rzjOPeQeVug=; b=oZajoClMH0W7mE4uBCLY+05Iko0oKuRmeQwj14SuundnCAKZJEurF/2c/1pv+6oC6P h69X3rzYiAbfNXWOgD2wBCfYnOIZudfBd1/NS+ks866ZiCuj1S6P4B6zwbF8uiaXb5e3 uWE2GC8YUI3OAv4U3GwHPtkLXvQRJ1Pe+5+vqWhp/QuxGTrPplLexz1wtfVErnk+5kBh rpUYm5/UG+pnTduA3EqEilj92F7G8vtXBa9wA3f1JuuXXKH2p/0/1alwNb4+knJ6qO99 ZnRaigFmFrSjQ98egKQRPl7yJWYrG3qho4RYRbDhsz/WxQtqzKXzYn85yZPCiiyN4U/w AM+w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si16858685plo.166.2019.09.04.01.15.30; Wed, 04 Sep 2019 01:15:52 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728604AbfIDIPU (ORCPT + 99 others); Wed, 4 Sep 2019 04:15:20 -0400 Received: from 8bytes.org ([81.169.241.247]:53108 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725267AbfIDIPU (ORCPT ); Wed, 4 Sep 2019 04:15:20 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 8A42E445; Wed, 4 Sep 2019 10:15:17 +0200 (CEST) Date: Wed, 4 Sep 2019 10:15:17 +0200 From: Joerg Roedel To: zhong jiang Cc: davem@davemloft.net, herbert@gondor.apana.org.au, arno@natisbad.org, gregkh@linuxfoundation.org, iommu@lists.linux-foundation.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] iommu/pamu: Use kzfree rather than its implementation Message-ID: <20190904081517.GA29855@8bytes.org> References: <1567566079-7412-1-git-send-email-zhongjiang@huawei.com> <1567566079-7412-3-git-send-email-zhongjiang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1567566079-7412-3-git-send-email-zhongjiang@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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. Regards, Joerg