Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1824283imm; Sat, 18 Aug 2018 05:21:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw+g/x6id0omj67vFJSYG35JIDe1JoSx4J9rJ3SXPvW6MSyB/0lEOZNOUVLTeNMHHXJbPad X-Received: by 2002:aa7:8118:: with SMTP id b24-v6mr40490066pfi.78.1534594866415; Sat, 18 Aug 2018 05:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534594866; cv=none; d=google.com; s=arc-20160816; b=wqVHCbl934CkNc+R9u39k8iv56gGk5Y8oSIXKmyPqO2PHGaQhQ+6F4Qtruho7Rn7nE ff2+w1hD7L/zTuE2sKYN3/GGCrwfNqQFNutZDASYmNFf+CKX2XfaeY3mzz/iOZqVUX/E KyK8OJ47jd3FgktBg10MxNFO1GU2XmhA5hfrLjMlk9NFtzqGFBs2EVUf5yooQnjYqSjX TxiT4llEIijs2QubVr6gGub6NEFEMrg5xNLZL3jN2Z/bCCmVKc+YpIxSt8OqI0CW2Rzl UVrX6/VaOja79f5yicxh53622Z8Iwt/aYMCrmoymIRdz6dItS40mDsvuU5qX/iE+VjSY YdFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=9bsXIjgBg8NmToJoo3VtoQeTz5DjyhFe4BqN0ke1Umo=; b=K+awNV4UTmWqiE3o50xUzVPZQKgOAdRnQEIL7r7DavgxcXTmz+VczrpVeSjO3/1Ew3 ymDu/hntHWTgrIfGGs7wZvqkwYmmyAXXBX9V0B2OJ/pqQgAL2oVV5X0FnEaZVTXF2Na1 qIi1CsfyumkQgosM3R22L3y7yGmsPZ6b6BkZOnzyAVIxFk6cf6wFaaEnb4SoaPcYk+RH ms+8PrBSIIwO+VxuAO3aYvBbQj7fX8rpjVORJUtSXoguOELjyrGZMvUx5vlFMUunj2k1 +Rjnm1m/xmXv+IsFAtnkHqTG9ZsqOHOWYeTsvUWyso8hZS3CmCiFVA+JG1rXzeCqLOWz +/JA== 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 p14-v6si4269868plo.357.2018.08.18.05.20.51; Sat, 18 Aug 2018 05:21:06 -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 S1726230AbeHRP1U (ORCPT + 99 others); Sat, 18 Aug 2018 11:27:20 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:55777 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbeHRP1U (ORCPT ); Sat, 18 Aug 2018 11:27:20 -0400 X-IronPort-AV: E=Sophos;i="5.53,256,1531778400"; d="scan'208";a="342917527" Received: from abo-214-111-68.mrs.modulonet.fr (HELO hadrien) ([85.68.111.214]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Aug 2018 14:19:46 +0200 Date: Sat, 18 Aug 2018 14:19:46 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: zhong jiang cc: Gilles Muller , nicolas.palix@imag.fr, michal.lkml@markovi.net, himanshujha199640@gmail.com, yamada.masahiro@socionext.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Coccinelle: remove pci_alloc_consistent semantic to dectect in zalloc-simple.cocci In-Reply-To: <1534593700-3036-1-git-send-email-zhongjiang@huawei.com> Message-ID: References: <1534593700-3036-1-git-send-email-zhongjiang@huawei.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 18 Aug 2018, zhong jiang wrote: > Because pci_alloc_consistent has been deprecated. We prefer to use > dam_alloc_coherent directly. Therefore, we should remove pci_alloc_consistent > to increase the confidence. > > Signed-off-by: zhong jiang Thanks for the suggestion. Acked-by: Julia Lawall > --- > scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +----------------------- > 1 file changed, 1 insertion(+), 40 deletions(-) > > diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci > index 92b2091..d819275 100644 > --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci > +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci > @@ -35,8 +35,7 @@ statement S; > > * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\| > kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\| > - devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\| > - kvmalloc_node(E1,...)\); > + devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|kvmalloc_node(E1,...)\); > if ((x==NULL) || ...) S > * memset((T2)x,0,E1); > > @@ -124,15 +123,6 @@ statement S; > - x = (T)kvmalloc(E1,E2); > + x = (T)kvzalloc(E1,E2); > | > -- x = pci_alloc_consistent(E2,E1,E3); > -+ x = pci_zalloc_consistent(E2,E1,E3); > -| > -- x = (T *)pci_alloc_consistent(E2,E1,E3); > -+ x = pci_zalloc_consistent(E2,E1,E3); > -| > -- x = (T)pci_alloc_consistent(E2,E1,E3); > -+ x = (T)pci_zalloc_consistent(E2,E1,E3); > -| > - x = kvmalloc_node(E1,E2,E3); > + x = kvzalloc_node(E1,E2,E3); > | > @@ -389,35 +379,6 @@ msg="WARNING: kvzalloc should be used for %s, instead of kvmalloc/memset" % (x) > coccilib.report.print_report(p[0], msg) > > //----------------------------------------------------------------- > -@r8 depends on org || report@ > -type T, T2; > -expression x; > -expression E1,E2,E3; > -statement S; > -position p; > -@@ > - > - x = (T)pci_alloc_consistent@p(E2,E1,E3); > - if ((x==NULL) || ...) S > - memset((T2)x,0,E1); > - > -@script:python depends on org@ > -p << r8.p; > -x << r8.x; > -@@ > - > -msg="%s" % (x) > -msg_safe=msg.replace("[","@(").replace("]",")") > -coccilib.org.print_todo(p[0], msg_safe) > - > -@script:python depends on report@ > -p << r8.p; > -x << r8.x; > -@@ > - > -msg="WARNING: pci_zalloc_consistent should be used for %s, instead of pci_alloc_consistent/memset" % (x) > -coccilib.report.print_report(p[0], msg) > -//----------------------------------------------------------------- > @r9 depends on org || report@ > type T, T2; > expression x; > -- > 1.7.12.4 > >