Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com>
---

CC: Gerd Hoffmann <kra...@redhat.com>
CC: "Gonglei (Arei)" <arei.gong...@huawei.com>
CC: Eduardo Habkost <ehabk...@redhat.com>
CC: Igor Mammedov <imamm...@redhat.com>
CC: Laurent Vivier <lviv...@redhat.com>
CC: Amit Shah <a...@kernel.org>
CC: Kevin Wolf <kw...@redhat.com>
CC: Max Reitz <mre...@redhat.com>
CC: John Snow <js...@redhat.com>
CC: Ari Sundholm <a...@tuxera.com>
CC: Pavel Dovgalyuk <pavel.dovga...@ispras.ru>
CC: Paolo Bonzini <pbonz...@redhat.com>
CC: Stefan Hajnoczi <stefa...@redhat.com>
CC: Fam Zheng <f...@euphon.net>
CC: Stefan Weil <s...@weilnetz.de>
CC: Ronnie Sahlberg <ronniesahlb...@gmail.com>
CC: Peter Lieven <p...@kamp.de>
CC: Eric Blake <ebl...@redhat.com>
CC: "Denis V. Lunev" <d...@openvz.org>
CC: Markus Armbruster <arm...@redhat.com>
CC: Alberto Garcia <be...@igalia.com>
CC: Jason Dillaman <dilla...@redhat.com>
CC: Wen Congyang <wencongya...@huawei.com>
CC: Xie Changlong <xiechanglon...@gmail.com>
CC: Liu Yuan <namei.u...@gmail.com>
CC: "Richard W.M. Jones" <rjo...@redhat.com>
CC: Jeff Cody <codypr...@gmail.com>
CC: "Marc-André Lureau" <marcandre.lur...@redhat.com>
CC: "Daniel P. Berrangé" <berra...@redhat.com>
CC: Richard Henderson <r...@twiddle.net>
CC: Greg Kurz <gr...@kaod.org>
CC: "Michael S. Tsirkin" <m...@redhat.com>
CC: Marcel Apfelbaum <marcel.apfelb...@gmail.com>
CC: Beniamino Galvani <b.galv...@gmail.com>
CC: Peter Maydell <peter.mayd...@linaro.org>
CC: "Cédric Le Goater" <c...@kaod.org>
CC: Andrew Jeffery <and...@aj.id.au>
CC: Joel Stanley <j...@jms.id.au>
CC: Andrew Baumann <andrew.baum...@microsoft.com>
CC: "Philippe Mathieu-Daudé" <phi...@redhat.com>
CC: Antony Pavlov <antonynpav...@gmail.com>
CC: Jean-Christophe Dubois <j...@tribudubois.net>
CC: Peter Chubb <peter.ch...@nicta.com.au>
CC: Subbaraya Sundeep <sundeep.l...@gmail.com>
CC: Eric Auger <eric.au...@redhat.com>
CC: Alistair Francis <alist...@alistair23.me>
CC: "Edgar E. Iglesias" <edgar.igles...@gmail.com>
CC: Stefano Stabellini <sstabell...@kernel.org>
CC: Anthony Perard <anthony.per...@citrix.com>
CC: Paul Durrant <p...@xen.org>
CC: Paul Burton <pbur...@wavecomp.com>
CC: Aleksandar Rikalo <arik...@wavecomp.com>
CC: Chris Wulff <crwu...@gmail.com>
CC: Marek Vasut <ma...@denx.de>
CC: David Gibson <da...@gibson.dropbear.id.au>
CC: Cornelia Huck <coh...@redhat.com>
CC: Halil Pasic <pa...@linux.ibm.com>
CC: Christian Borntraeger <borntrae...@de.ibm.com>
CC: "Hervé Poussineau" <hpous...@reactos.org>
CC: Xiao Guangrong <xiaoguangrong.e...@gmail.com>
CC: Aurelien Jarno <aurel...@aurel32.net>
CC: Aleksandar Markovic <amarko...@wavecomp.com>
CC: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk>
CC: Jason Wang <jasow...@redhat.com>
CC: Laszlo Ersek <ler...@redhat.com>
CC: Yuval Shaia <yuval.sh...@oracle.com>
CC: Palmer Dabbelt <pal...@sifive.com>
CC: Sagar Karandikar <sag...@eecs.berkeley.edu>
CC: Bastian Koppelmann <kbast...@mail.uni-paderborn.de>
CC: David Hildenbrand <da...@redhat.com>
CC: Thomas Huth <th...@redhat.com>
CC: Eric Farman <far...@linux.ibm.com>
CC: Matthew Rosato <mjros...@linux.ibm.com>
CC: Hannes Reinecke <h...@suse.com>
CC: Michael Walle <mich...@walle.cc>
CC: Artyom Tarasenko <atar4q...@gmail.com>
CC: Stefan Berger <stef...@linux.ibm.com>
CC: Samuel Thibault <samuel.thiba...@ens-lyon.org>
CC: Alex Williamson <alex.william...@redhat.com>
CC: Tony Krowiak <akrow...@linux.ibm.com>
CC: Pierre Morel <pmo...@linux.ibm.com>
CC: Michael Roth <mdr...@linux.vnet.ibm.com>
CC: Hailiang Zhang <zhang.zhanghaili...@huawei.com>
CC: Juan Quintela <quint...@redhat.com>
CC: "Dr. David Alan Gilbert" <dgilb...@redhat.com>
CC: Luigi Rizzo <ri...@iet.unipi.it>
CC: Giuseppe Lettieri <g.letti...@iet.unipi.it>
CC: Vincenzo Maffione <v.maffi...@gmail.com>
CC: Jan Kiszka <jan.kis...@siemens.com>
CC: Anthony Green <gr...@moxielogic.com>
CC: Stafford Horne <sho...@gmail.com>
CC: Guan Xuetao <g...@mprc.pku.edu.cn>
CC: Max Filippov <jcmvb...@gmail.com>
CC: qemu-bl...@nongnu.org
CC: integrat...@gluster.org
CC: sheep...@lists.wpkg.org
CC: qemu-...@nongnu.org
CC: xen-devel@lists.xenproject.org
CC: qemu-...@nongnu.org
CC: qemu-s3...@nongnu.org
CC: qemu-ri...@nongnu.org

 scripts/coccinelle/auto-propagated-errp.cocci | 118 ++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100644 scripts/coccinelle/auto-propagated-errp.cocci

diff --git a/scripts/coccinelle/auto-propagated-errp.cocci 
b/scripts/coccinelle/auto-propagated-errp.cocci
new file mode 100644
index 0000000000..d9731620aa
--- /dev/null
+++ b/scripts/coccinelle/auto-propagated-errp.cocci
@@ -0,0 +1,118 @@
+@rule0@
+// Add invocation to errp-functions where necessary
+identifier fn, local_err;
+symbol errp;
+@@
+
+ fn(..., Error **errp, ...)
+ {
++   ERRP_AUTO_PROPAGATE();
+    <+...
+(
+    error_append_hint(errp, ...);
+|
+    error_prepend(errp, ...);
+|
+    Error *local_err = NULL;
+)
+    ...+>
+ }
+
+@@
+// Drop doubled invocation
+identifier rule0.fn;
+@@
+
+ fn(...)
+{
+-   ERRP_AUTO_PROPAGATE();
+    ERRP_AUTO_PROPAGATE();
+    ...
+}
+
+@rule1@
+// Drop local_err
+identifier fn, local_err;
+symbol errp;
+@@
+
+ fn(..., Error **errp, ...)
+ {
+     <...
+-    Error *local_err = NULL;
+     ...>
+ }
+
+@@
+// Handle pattern with goto, otherwise we'll finish up
+// with labels at function end which will not compile.
+identifier rule1.fn;
+identifier rule1.local_err;
+identifier OUT;
+@@
+
+ fn(...)
+ {
+     <...
+-    goto OUT;
++    return;
+     ...>
+- OUT:
+-    error_propagate(errp, local_err);
+ }
+
+@@
+identifier rule1.fn;
+identifier rule1.local_err;
+@@
+
+ fn(...)
+ {
+     <...
+(
+-    error_free(local_err);
+-    local_err = NULL;
++    error_free_errp(errp);
+|
+-    error_free(local_err);
++    error_free_errp(errp);
+|
+-    error_report_err(local_err);
++    error_report_errp(errp);
+|
+-    warn_report_err(local_err);
++    warn_report_errp(errp);
+|
+-    error_propagate_prepend(errp, local_err,
++    error_prepend(errp,
+                              ...);
+|
+-    error_propagate(errp, local_err);
+)
+     ...>
+ }
+
+@@
+identifier rule1.fn;
+identifier rule1.local_err;
+@@
+
+ fn(...)
+ {
+     <...
+(
+-    &local_err
++    errp
+|
+-    local_err
++    *errp
+)
+     ...>
+ }
+
+@@
+symbol errp;
+@@
+
+- *errp != NULL
++ *errp
-- 
2.21.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to