From patchwork Fri Jan 6 15:51:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 134673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BB705B6FBE for ; Sat, 7 Jan 2012 02:53:13 +1100 (EST) Received: from localhost ([::1]:42519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjC6P-0003vy-QY for incoming@patchwork.ozlabs.org; Fri, 06 Jan 2012 10:53:09 -0500 Received: from eggs.gnu.org ([140.186.70.92]:33713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjC68-0003iC-F6 for qemu-devel@nongnu.org; Fri, 06 Jan 2012 10:52:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjC66-0006X6-UZ for qemu-devel@nongnu.org; Fri, 06 Jan 2012 10:52:52 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:45031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjC66-0006Wm-NW for qemu-devel@nongnu.org; Fri, 06 Jan 2012 10:52:50 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 6 Jan 2012 15:52:48 -0000 Received: from d06nrmr1407.portsmouth.uk.ibm.com ([9.149.38.185]) by e06smtp10.uk.ibm.com ([192.168.101.140]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 6 Jan 2012 15:52:43 -0000 Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q06Fqhnr2019578 for ; Fri, 6 Jan 2012 15:52:43 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q06FqhoW021909 for ; Fri, 6 Jan 2012 08:52:43 -0700 Received: from localhost (stefanha-thinkpad.manchester-maybrook.uk.ibm.com [9.174.219.31]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q06FqgPs021902; Fri, 6 Jan 2012 08:52:42 -0700 From: Stefan Hajnoczi To: Date: Fri, 6 Jan 2012 15:51:21 +0000 Message-Id: <1325865088-23897-3-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1325865088-23897-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1325865088-23897-1-git-send-email-stefanha@linux.vnet.ibm.com> x-cbid: 12010615-4966-0000-0000-00000112FCA5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 195.75.94.106 Cc: Anthony Liguori , Markus Armbruster Subject: [Qemu-devel] [PATCH 2/9] Strip trailing '\n' from error_report()'s first argument (again) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Markus Armbruster Commit 6daf194d got rid of them, but Hans and Gerd added some more lately. Tracked down with this Coccinelle semantic patch: @r@ expression fmt; position p; @@ error_report(fmt, ...)@p @script:python@ fmt << r.fmt; p << r.p; @@ if "\\n" in str(fmt): print "%s:%s:%s:%s" % (p[0].file, p[0].line, p[0].column, fmt) Signed-off-by: Markus Armbruster --- hw/usb-bus.c | 12 ++++++------ usb-redir.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/usb-bus.c b/hw/usb-bus.c index 8203390..bd4afa7 100644 --- a/hw/usb-bus.c +++ b/hw/usb-bus.c @@ -137,7 +137,7 @@ USBDevice *usb_create(USBBus *bus, const char *name) bus = usb_bus_find(-1); if (!bus) return NULL; - error_report("%s: no bus specified, using \"%s\" for \"%s\"\n", + error_report("%s: no bus specified, using \"%s\" for \"%s\"", __FUNCTION__, bus->qbus.name, name); } #endif @@ -152,12 +152,12 @@ USBDevice *usb_create_simple(USBBus *bus, const char *name) int rc; if (!dev) { - error_report("Failed to create USB device '%s'\n", name); + error_report("Failed to create USB device '%s'", name); return NULL; } rc = qdev_init(&dev->qdev); if (rc < 0) { - error_report("Failed to initialize USB device '%s'\n", name); + error_report("Failed to initialize USB device '%s'", name); return NULL; } return dev; @@ -244,7 +244,7 @@ int usb_claim_port(USBDevice *dev) } } if (port == NULL) { - error_report("Error: usb port %s (bus %s) not found (in use?)\n", + error_report("Error: usb port %s (bus %s) not found (in use?)", dev->port_path, bus->qbus.name); return -1; } @@ -255,7 +255,7 @@ int usb_claim_port(USBDevice *dev) } if (bus->nfree == 0) { error_report("Error: tried to attach usb device %s to a bus " - "with no free ports\n", dev->product_desc); + "with no free ports", dev->product_desc); return -1; } port = QTAILQ_FIRST(&bus->free); @@ -302,7 +302,7 @@ int usb_device_attach(USBDevice *dev) if (!(port->speedmask & dev->speedmask)) { error_report("Warning: speed mismatch trying to attach " - "usb device %s to bus %s\n", + "usb device %s to bus %s", dev->product_desc, bus->qbus.name); return -1; } diff --git a/usb-redir.c b/usb-redir.c index a36f2a7..2b53cf3 100644 --- a/usb-redir.c +++ b/usb-redir.c @@ -174,7 +174,7 @@ static void usbredir_log(void *priv, int level, const char *msg) return; } - error_report("%s\n", msg); + error_report("%s", msg); } static void usbredir_log_data(USBRedirDevice *dev, const char *desc, @@ -193,7 +193,7 @@ static void usbredir_log_data(USBRedirDevice *dev, const char *desc, for (j = 0; j < 8 && i + j < len; j++) { n += sprintf(buf + n, " %02X", data[i + j]); } - error_report("%s\n", buf); + error_report("%s", buf); } }