From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbcF2Sdy (ORCPT ); Wed, 29 Jun 2016 14:33:54 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36412 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbcF2Sdx (ORCPT ); Wed, 29 Jun 2016 14:33:53 -0400 Date: Thu, 30 Jun 2016 00:03:47 +0530 From: Amitoj Kaur Chawla To: Julia.Lawall@lip6.fr, Gilles.Muller@lip6.fr, nicolas.palix@imag.fr, mmarek@suse.com, cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: [PATCH] Coccinelle: Script to replace NULL test with IS_ERR test for devm_ioremap_resource Message-ID: <20160629183347.GA17067@amitoj-Inspiron-3542> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This script detects cases which have incorrect error handling for devm_ioremap_resource function, employing a NULL test instead of an IS_ERR() test. Signed-off-by: Amitoj Kaur Chawla --- .../coccinelle/null/devm_ioremap_resource.cocci | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/coccinelle/null/devm_ioremap_resource.cocci diff --git a/scripts/coccinelle/null/devm_ioremap_resource.cocci b/scripts/coccinelle/null/devm_ioremap_resource.cocci new file mode 100644 index 0000000..bc87efa --- /dev/null +++ b/scripts/coccinelle/null/devm_ioremap_resource.cocci @@ -0,0 +1,37 @@ +/// Correct error handling for devm_ioremap_resource +/// +// Confidence: High +// Copyright: (C) 2016 Amitoj Kaur Chawla +// Keywords: devm,devm_ioremap_resource + +virtual context +virtual org +virtual report + +// ---------------------------------------------------------------------------- + +@err depends on context || org || report@ +statement S; +expression e; +position j0; +@@ + + e = devm_ioremap_resource(...); +* if (!e@j0) S +// ---------------------------------------------------------------------------- + +@script:python err_org depends on org@ +j0 << err.j0; +@@ + +msg = "Incorrect error handling." +coccilib.org.print_todo(j0[0], msg) + +// ---------------------------------------------------------------------------- + +@script:python err_report depends on report@ +j0 << err.j0; +@@ + +msg = "Incorrect error handling." +coccilib.report.print_report(j0[0], msg) -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: amitoj1606@gmail.com (Amitoj Kaur Chawla) Date: Thu, 30 Jun 2016 00:03:47 +0530 Subject: [Cocci] [PATCH] Coccinelle: Script to replace NULL test with IS_ERR test for devm_ioremap_resource Message-ID: <20160629183347.GA17067@amitoj-Inspiron-3542> To: cocci@systeme.lip6.fr List-Id: cocci@systeme.lip6.fr This script detects cases which have incorrect error handling for devm_ioremap_resource function, employing a NULL test instead of an IS_ERR() test. Signed-off-by: Amitoj Kaur Chawla --- .../coccinelle/null/devm_ioremap_resource.cocci | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 scripts/coccinelle/null/devm_ioremap_resource.cocci diff --git a/scripts/coccinelle/null/devm_ioremap_resource.cocci b/scripts/coccinelle/null/devm_ioremap_resource.cocci new file mode 100644 index 0000000..bc87efa --- /dev/null +++ b/scripts/coccinelle/null/devm_ioremap_resource.cocci @@ -0,0 +1,37 @@ +/// Correct error handling for devm_ioremap_resource +/// +// Confidence: High +// Copyright: (C) 2016 Amitoj Kaur Chawla +// Keywords: devm,devm_ioremap_resource + +virtual context +virtual org +virtual report + +// ---------------------------------------------------------------------------- + + at err depends on context || org || report@ +statement S; +expression e; +position j0; +@@ + + e = devm_ioremap_resource(...); +* if (!e at j0) S +// ---------------------------------------------------------------------------- + + at script:python err_org depends on org@ +j0 << err.j0; +@@ + +msg = "Incorrect error handling." +coccilib.org.print_todo(j0[0], msg) + +// ---------------------------------------------------------------------------- + +@script:python err_report depends on report@ +j0 << err.j0; +@@ + +msg = "Incorrect error handling." +coccilib.report.print_report(j0[0], msg) -- 1.9.1