Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp59649pxj; Wed, 16 Jun 2021 20:16:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/CGSQWGUxcoxq6Kay+bJts5aMYFU0dFjYTylcZBiYTGFpVE5FB/nLRTHoD7WljatN1V/m X-Received: by 2002:a17:906:b855:: with SMTP id ga21mr2732027ejb.550.1623899772535; Wed, 16 Jun 2021 20:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623899772; cv=none; d=google.com; s=arc-20160816; b=aewOtQFtYxedA5Zl1B2IqVmagiMuNNXOSDdg1c2w88Rl65a1lX3bhAG2ttH9QHqYp7 g+Ye0gMn2vrdqP9FfnS55l8xckJqcHgff4+Wdjv3mPERgrfk0oksasHPxgHg6BTw6pCr x88cSghPBTyBzk3F4T0YuwaTKGRrHfDm7ywvICm9NLwh9BaXcJIuXYa5jlCVsaoKC21l My7T/Vsua08tWK9ZsnYjoD3gDPkPXWeVNHmDF1tC/0UhYyGaHQA/7WBQ68RmWWNv9Ixj Si4j4hftfbpUxLL+WCmefYqY3N51l4x8yaoqKydAYp1KIyH/koMm4aWaNole8qtKoeSL 39rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=sMzaOS4DqUUFWW55rNAxlZKM0wnskLTf65UO+dXvxBc=; b=GvrdHfMdKw9e3h50n2BzrCdBsSPyekBye5YNp4L+XyYrcRMMxH3VVeQKs8+Whf7Gul kvVVW4RPesBNPG+Yt/CzDmpRJw/GTsX9iXz5uJMmhA/2DoGmBOobMP6lemQufF5qI3Hl jsptMf/EEol29+FEsZJ7Q4yjDKfykjK1z3pB6yvlAss9NfasF3TML7WWj3F/WpspLFXq tNPd1vvTRb3fWiiWZbM8eNgQpJjBcO7cqn9a6IZKrV6PPtzL0yw6KAdsCoGOrwM2+Kuw aPSJNw5EJi/pM2JeXQpDTn1PeByJ+OU6KayEPeb9rL0cNwZ/QawfT1zSR+uVD3s0Gjqf 4tOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v29si3829098ejv.340.2021.06.16.20.15.50; Wed, 16 Jun 2021 20:16:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232755AbhFPT0w (ORCPT + 99 others); Wed, 16 Jun 2021 15:26:52 -0400 Received: from smtp08.smtpout.orange.fr ([80.12.242.130]:34336 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232670AbhFPT0v (ORCPT ); Wed, 16 Jun 2021 15:26:51 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d88 with ME id HvQi2500821Fzsu03vQiMT; Wed, 16 Jun 2021 21:24:43 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 16 Jun 2021 21:24:43 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: Julia.Lawall@inria.fr, Gilles.Muller@inria.fr, nicolas.palix@imag.fr, michal.lkml@markovi.net Cc: cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] Coccinelle: Update and rename api/alloc/pci_free_consistent.cocci Date: Wed, 16 Jun 2021 21:24:39 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'pci_alloc_consistent()' is about to be removed from the kernel. It is now more useful to check for dma_alloc_coherent/dma_free_coherent. So change the script accordingly and rename it. Signed-off-by: Christophe JAILLET --- Not sure that the script works. There are 718 'dma_alloc_coherent' calls in 5.13-rc6. It is surprising to have no match at all, not even a single false positive. --- ..._consistent.cocci => dma_free_coherent.cocci} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename scripts/coccinelle/free/{pci_free_consistent.cocci => dma_free_coherent.cocci} (52%) diff --git a/scripts/coccinelle/free/pci_free_consistent.cocci b/scripts/coccinelle/free/dma_free_coherent.cocci similarity index 52% rename from scripts/coccinelle/free/pci_free_consistent.cocci rename to scripts/coccinelle/free/dma_free_coherent.cocci index d51e92556b42..75f159e7b6d7 100644 --- a/scripts/coccinelle/free/pci_free_consistent.cocci +++ b/scripts/coccinelle/free/dma_free_coherent.cocci @@ -1,10 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-only -/// Find missing pci_free_consistent for every pci_alloc_consistent. +/// Find missing dma_free_coherent for every dma_alloc_coherent. /// // Confidence: Moderate // Copyright: (C) 2013 Petr Strnad. // URL: http://coccinelle.lip6.fr/ -// Keywords: pci_free_consistent, pci_alloc_consistent +// Keywords: dma_free_coherent, dma_alloc_coherent // Options: --no-includes --include-headers virtual report @@ -17,12 +17,12 @@ position p1,p2; type T; @@ -id = pci_alloc_consistent@p1(x,y,&z) +id = dma_alloc_coherent@p1(x,y,&z) ... when != e = id if (id == NULL || ...) { ... return ...; } -... when != pci_free_consistent(x,y,id,z) - when != if (id) { ... pci_free_consistent(x,y,id,z) ... } - when != if (y) { ... pci_free_consistent(x,y,id,z) ... } +... when != dma_free_coherent(x,y,id,z) + when != if (id) { ... dma_free_coherent(x,y,id,z) ... } + when != if (y) { ... dma_free_coherent(x,y,id,z) ... } when != e = (T)id when exists ( @@ -40,7 +40,7 @@ p1 << search.p1; p2 << search.p2; @@ -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line) +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line) coccilib.report.print_report(p2[0],msg) @script:python depends on org@ @@ -48,6 +48,6 @@ p1 << search.p1; p2 << search.p2; @@ -msg = "ERROR: missing pci_free_consistent; pci_alloc_consistent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line) +msg = "ERROR: missing dma_free_coherent; dma_alloc_coherent on line %s and return without freeing on line %s" % (p1[0].line,p2[0].line) cocci.print_main(msg,p1) cocci.print_secs("",p2) -- 2.30.2