Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp842664ybc; Tue, 19 Nov 2019 10:08:34 -0800 (PST) X-Google-Smtp-Source: APXvYqyaaN8IJGV56Ye5y5HHmOKyxA77HUMav8fMvV81EslLBL+RU/+nAg2ehMIjGonDnq3Vi2LA X-Received: by 2002:adf:f6cf:: with SMTP id y15mr36451871wrp.97.1574186913898; Tue, 19 Nov 2019 10:08:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574186913; cv=none; d=google.com; s=arc-20160816; b=LVkJmuKL/H0PGRy6dYHdCmmlAHfrEzXeIcAvC266kWJ8FWg7r9zRBGWp83BS0knjI9 k9CC3BjB6GcuMC51ZABB8QLP8rB7nKtjBGOC9gtJsOd9ELwVQ87LzakJ0tGjq6ORi1XV BXYbaMT2D2tVUS6EIlsklGgaYQFr3Q64UqgaeBk1Qp7lFiOO7y1buuc/rZHFkiNkwLXd Rjx7SOcD5+LuNrfQCJmU3m7Z8rhcX1YM0e9JYLEL3ZCd6ID5hmOa29gVcJuTBOR6EOIa LYLYK/cKoQ0kDIbDohWa9ciutWCr0sCS458bLRFibgKHCq7ygqjSeLLwyx47QzZZSI1w UFOg== 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 v16si17045056edc.142.2019.11.19.10.08.10; Tue, 19 Nov 2019 10:08:33 -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 S1727395AbfKSSER (ORCPT + 99 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 =