From patchwork Tue Nov 19 17:28:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 179782 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp984462ilf; Tue, 19 Nov 2019 10:04:19 -0800 (PST) X-Google-Smtp-Source: APXvYqzLTCC0PNN0ERJMuFoVmXwR5Bk2E8HOKpeVzrCRa/hff4tIsXQlxWUUvwivmWk4N5Ca1aHw X-Received: by 2002:adf:b199:: with SMTP id q25mr41423637wra.320.1574186659260; Tue, 19 Nov 2019 10:04:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574186659; cv=none; d=google.com; s=arc-20160816; b=jrvsUVSYcdM/YjDRRTXk9vxt9YuRN0onZCF7Q5F0qfnGsPMIT+5n4I6+lnfmU+V7SV aBoC4t1vcFgMHwL91qxv5mGpAv1UYkDbWy4wnEmd7w4FcyFxdsFBhwcCYa999vupyhF3 7jxXuVStxxnE6VXvRfKNkqOF4KIjFcxtql17Vkg/xdjcg739nqKe1+ooOv0udsKL6Qh4 XTyONm6B015pQhCNr7wTloeHNAtTNVLVolwL/7n1hO5ljmQcfETmiEqRpILPMQwRxb2R iawu8KAfQJBOZto960MJBk5S7k9PDXMrmlKxgourSTyWyDbQ5bnJD4GGy/glmJLcOke1 MKHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=a5KbyJ1jZYGPG0P0v/dOcYlnqG3vw087hdY6av+QWio=; b=tPBk5zNCfymzB1eSa0RZVADRNXp9r6h7BIreCIwrOZURS9qrOYfbdeABcc0TWjH7w9 E5ti/AhxAIoOcu/AkpFcS6DO6CpXQ/7hakYZnhzqjH9+N8VkSBe+TYe3eU6fLmLFF6uA LyNZsnFWd5gcu1ej9GfuTvIfOyo/DOJi2/o4VZ2ToBNqbklu/CFHI1wzRG6c7CJEgt/W eK2ysM8oUv8m59TBgqapGOpFE91Yf4WFFSNPyk5Pg00ROWNsSA8qBnYsALBWGn4W3Kwy 9y5VNb3rMK2/eEsjFJyOLPXkcbX8/xHCxtAewmiURLf/jxjpN3Mp6CHkuVrjY/KVqNVB eqfA== 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 z16si15392968edx.337.2019.11.19.10.04.18; Tue, 19 Nov 2019 10:04:19 -0800 (PST) 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 S1727407AbfKSSER (ORCPT + 26 others); Tue, 19 Nov 2019 13:04:17 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:4369 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727031AbfKSSEF (ORCPT ); Tue, 19 Nov 2019 13:04:05 -0500 X-IronPort-AV: E=Sophos;i="5.69,218,1571695200"; d="scan'208";a="412559095" Received: from palace.lip6.fr ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 19 Nov 2019 19:04:02 +0100 From: Julia Lawall To: Julia Lawall Cc: kernel-janitors@vger.kernel.org, Masahiro Yamada , Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] coccinelle: platform_get_irq: handle 2-statement branches Date: Tue, 19 Nov 2019 18:28:18 +0100 Message-Id: <1574184500-29870-3-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1574184500-29870-1-git-send-email-Julia.Lawall@lip6.fr> References: <1574184500-29870-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada Treat separately the case where there is only one other statement in the branch, to be able to remove the outer {} as well. Signed-off-by: Julia Lawall --- scripts/coccinelle/api/platform_get_irq.cocci | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/api/platform_get_irq.cocci b/scripts/coccinelle/api/platform_get_irq.cocci index c6ac755..7ac32ee 100644 --- a/scripts/coccinelle/api/platform_get_irq.cocci +++ b/scripts/coccinelle/api/platform_get_irq.cocci @@ -31,6 +31,25 @@ if ( \( ret < 0 \| ret <= 0 \) ) @depends on patch@ expression ret; struct platform_device *E; +statement S; +@@ + +ret = +( +platform_get_irq +| +platform_get_irq_byname +)(E, ...); + +if ( \( ret < 0 \| ret <= 0 \) ) +-{ +-dev_err(...); +S +-} + +@depends on patch@ +expression ret; +struct platform_device *E; @@ ret =