From patchwork Wed Nov 8 22:58:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 836057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="y+ocfOFU"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yXMbb3Hwbz9s3w for ; Thu, 9 Nov 2017 10:15:38 +1100 (AEDT) Received: from localhost ([::1]:34375 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCZZH-0002Rm-Lq for incoming@patchwork.ozlabs.org; Wed, 08 Nov 2017 18:15:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCZN3-0000wZ-HQ for qemu-devel@nongnu.org; Wed, 08 Nov 2017 18:03:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCZN0-0003nr-NZ for qemu-devel@nongnu.org; Wed, 08 Nov 2017 18:02:57 -0500 Received: from mail-cys01nam02on0085.outbound.protection.outlook.com ([104.47.37.85]:43670 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCZN0-0003nP-Ej for qemu-devel@nongnu.org; Wed, 08 Nov 2017 18:02:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=f0auA1vbmctzRI7VYJLpMUXn2CkwBD1eNrm7y5Hxy9A=; b=y+ocfOFU5dImSQDLxgKsMMcOUTdezDUtKf8ci5njHt81WkYXEMDUL38HxhuW/CLtaEyNxPZg5icZzqUV+sQgC00hlIl0j1LCvKMeNrXbcJXogmfvOhkw0RBH4uNWr4H41vqUjitW75VqIyC0WtQQ8BuyxjjcV6RHjsZIvpcyipY= Received: from SN4PR0201CA0007.namprd02.prod.outlook.com (10.161.238.145) by CY4PR02MB3384.namprd02.prod.outlook.com (10.165.89.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Wed, 8 Nov 2017 23:02:50 +0000 Received: from BL2NAM02FT047.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::207) by SN4PR0201CA0007.outlook.office365.com (2603:10b6:803:2b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.218.12 via Frontend Transport; Wed, 8 Nov 2017 23:02:50 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT047.mail.protection.outlook.com (10.152.77.9) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.197.9 via Frontend Transport; Wed, 8 Nov 2017 23:02:49 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1eCZMv-0001NX-06; Wed, 08 Nov 2017 15:02:49 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eCZMu-00039K-NN; Wed, 08 Nov 2017 15:02:48 -0800 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id vA8N2k7N010485; Wed, 8 Nov 2017 15:02:46 -0800 Received: from [172.19.2.220] (helo=xsjalistai50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eCZMs-00039C-34; Wed, 08 Nov 2017 15:02:46 -0800 From: Alistair Francis To: Date: Wed, 8 Nov 2017 14:58:48 -0800 Message-ID: <8f75308c61d00e28e9fa28ba9f84f8ab7df470b9.1510181732.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-23450.000 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(346002)(39860400002)(376002)(2980300002)(438002)(199003)(189002)(50466002)(189998001)(39060400002)(54906003)(16586007)(47776003)(478600001)(5003940100001)(36386004)(6306002)(48376002)(316002)(77096006)(551934003)(50986999)(9786002)(356003)(6916009)(2950100002)(118296001)(76176999)(4326008)(106002)(50226002)(305945005)(5660300001)(575784001)(106466001)(81166006)(8936002)(2351001)(8676002)(63266004)(2906002)(81156014)(33646002)(36756003)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR02MB3384; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2NAM02FT047; 1:9chZ7nC09bUKkB/BnFo33M2wMgCZxIpalW/TmM3i54hSOE/0aFzD5vAsiIoyHuLs1jFXQdmar0uJOXtuJ4Ttg1mz2yQhL0vs0qRyIAkxDeLpEAln5xQ3twjWG/dkEKcr MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9dffaeb7-6b10-4cb6-5aee-08d526fcd5b0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199); SRVR:CY4PR02MB3384; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3384; 3:4NySxFH6gRnyn1swIkJvXz2M0Zig0JeEiUV4owANQvBSHrp2FTrWF9EJTgE+tpUnfwkDV8tJoIli3pFWCt9zPBVC5fGzAvQSSDpYo4YI8moVjvO/Z4jopfVNffcSAaepZZfe1NEnSu1otkIm5oE8HMgMZQTdKcA4ElczYZmQ311RKBFItkzSqEZKBEQLDp1zO9IXZQA6khMARQFHPb3XQliLQU8e5v1PvLj/bPyGHDnxR6PQKbIKb3iis412ALl+NSNB7vzvyLv0a7AIcb1IdCYl0KyR1UAX5ypJ/xpW94gZbBT3V5gNoNsxiXhf8EoR9/93wPUjOybNuX1EUv9E5o0PVFaax3BmSRNHg9AvzZs=; 25:PEbxIn1qkxTYKSrh5qiZpExYDJst5ZzUWivYQmHpJUZXSYOilMvLhpybKh/LuAjjpqb6csbqxglk/eTmTvSS6QqdFvqgMYH+roGaq/ErrRZWWpcwsg7EohMOxGftRyZYkqaWUdPLKdVjCPlIJVZx+8VIPNoV59e8zqDSHvDZexjRT9dY5Lbk0VDlwIfJH6s17Jzyooz4XiYUNRJ20H+F9DOMzJpN1HxgaThXN6W7Gjcd8l5itLnzXAlccJsOE/PxqMTIt+N83C2SXHfaDA7MDtBKFBHYaBhYOO8lkoF+lMeK7m28KtJdjIz7r9cGhdCF61fTVuIzeUTe9fNF6IGnmg== X-MS-TrafficTypeDiagnostic: CY4PR02MB3384: X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3384; 31:GS83NbhNOQUlxNW9FmAIC6diDQMqAHxL9+QF/kUHTDhcw6Mc4R8DPqCEIhXdR2XxwbQPSlQuCCI5poVET+h8rrTAmxObrZBJhGITU5Jop6YILTMQX+sDf4UtXEsBNSyY3oM/Ltp8kqJDixoHEeWhMhvZW05fVugqgEWEHgVmerX6g0oaWfRd80gx+7e6h7rnBSWX5LpTtv2EdmBq+bZClc92f/aDYH1S3n5S9u5n9b0=; 20:Arte3sKDeiSg8VTkvBNKWxR1KPWNsBt1zgYGuw6h7PxYp+3OzwaeZsC+lsjaE9GgdYHQWTW1VO5Iaq77pMgv22o4OomXo13u+qwaAMuiRcWS+HOwO48T1bOmcnjoWnAyGDSyteG6vZnKvgK72cpy6z6Q/DlYk+EYoRIw2Fuea5FENRIM2Ulpldj8tlrk+gT6uive8Z1i8RNq/pQeDwS4ozPVyoQGmmIFbV2QvLLfPeUDMu79ySUn7L07wgNbKMlAnmcASns5FZNvri/nNtw87UfnjXb4qA9EYu0Cwr1dLQOey6RL9vH7FUh88Z482oYBNzxY+YI+Q1Qc0V9AZYftnxurHJXRmc9WaOMnz8jRj8szeJSdfwiTrSJbapBWm4RGEjaeqMx+NAj1v9cgrTcXOBmCGs9KDKUGIXO8Sm/2Ux4kX+q7oPpfxAcSqZU/qV/KyfKyhPYBgnk8k15s0//isZyToB1FyJQV9To6FohrB9L3eX3NrQDK1G9n8Xy1hNxE X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(72170088055959)(22074186197030)(788757137089)(192813158149592); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231021)(3002001)(93006095)(93004095)(100000703101)(100105400095)(6055026)(6041248)(20161123562025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR02MB3384; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR02MB3384; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3384; 4:57IkrJ4xHJ8QHGBqcuijoi66DqfFlUtFUSBZaMXsXCw736aBUh0u9h28tK6PUxPO3skNzw3EjpN3+uo42DBXJCunBNuu0KGW4Tp/phdePlFyw8cloEZM5+Fu2r5tUikF6i8OndESWMf1mxKzz5ThtEgy+W/UdmKueAkXEBFPnxn0eP0xrXP6At7a1QSp21RqnbTPNAiqI265fqFEDLSEroHZBgUjrviQXEcvXYuEun8fftGWsHKKNl2P/+2wBDfSOHBORxmy8x1cxYyc+c8ZCHnw8kRTA0vovhB7MQePvWk0+ZCL/46NmtCxTLlTD7zyEITdZh5c5+9P2Hp54piLBh4Sm5k/JzV/wBmnycw3c/waiZh5V4idicOQbSsORnJCjttwCJd7aX80u2RkOCybrSs3hzAUuNTHvJlXHZG72GNRpI9eRusEjrMUTySKHtnN X-Forefront-PRVS: 0485417665 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR02MB3384; 23:SH+ABpuGr5T5o7MCOX7g1xO3ybU/ES8Bfdx2LUnPs?= FqDPys7u8rTmrxRqre77JvPkTTdpiypy0F5+OTm8P0xalplweUrIhUigCdzTc6M3MD3Mp91JC+/eBeTeJ3zCxgMlzFJfONOr3JNXvUkLdMoyBJNW9Cnc34QtciIdf2NKe+eO0vs5RzS4aWMVSEj4xLWxLar9n8vRWdLai1JFyHBDZJ88jekvRFClqIlBsJCK4rsPRg0od/IvpCSstgnR6k5TkJI6ys9asqJdBb9gcHbrbwc/W8lfVW2Gc5iczrVwCQ2WJuxl0NXmpbPa9nf8Y7dGUB1Mx+zTcPYu8Ets5zDzENSOLadyrRqdOA6bttjvSXTS/Cp3dkLNmIxDbP3qhs9QK6Cq8XaOPQT4XSecB04d+tLS1w9espfYSZaWGyIC+uB/9hk2Q4insVBuCUkl0VjK38xh71RV2wBBqqbJZHdArIDXW2zUn28wJpc+hjIZmIbxxyYzocTyvug4PVrFkj1TuzZ6DkzP5q21AP4oeNP5oaEea53sSqOSvWNeqhtsotNapoY6CF8RMmoPEmj/spfCKL1EP5aFhjRg3VspHLt+1YI5aC5u+8uxFgILeb1kjNB6F3XXkGosNAA2GtBBEDy0Aw2rHgUIbrrN8h03W3aYGEbiOmkXYsE9+bpK9fva0f99B5aNKqifHe6bpKuyMnLkAJ6li2VhNrdBXHnPGaPkVMcx4IFTT8IZwlRp3bs5xor05/vT7TlVIXtak99n7kMxDrLeti/Slk1bOem6csxMhM0oQwrNTA8gYDcGy4YkhVJyXd1abRRlZB0WwPtbGALZT8AUyRGjnZGHqrbAPx0VYjIvNSvCrHXJsUZFJQHWAAadXEFjxiMbtCWBE3LiiWc733RIkrgP2raTH/O7j++b7zuP7vAjrziADdLJT7LNqN5i028Pi+s3gm4QJZ0Y442BL36RkYRQTCV6/kEzJHfveZCUQ/jGQOXrXgIflTZEjy+KcFf2P1Oi0UWAIIksribT5OVdDL5PFCEs9BGPtbJmFpDy2QWk1T0/7oRT5mr84N68rbObky6vTDLMg/bkV5fz8sYP7j7U+domZiTwjjiWg== X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3384; 6:IKQNOosiJOnCABTLNAfmAZ0pHz3FyxYcl9s4lVVQj9bTqTVYapqACHhEw5+ulTKFq4nTN1y4HVxqr/pNObv5ATDiW1dQmvEApbqoKsDbEhA0BIT9nvET4LCa/uPpPzY8iwsdmZkZ+HzmTCLaZ/9kKLkXa2BUpmZCcmqTo5uQAZfxWD+cSa0dnDAa12ROfQD5vkbi257kRqGz/jsN2wkiaFotr7xhDnGYS5ZrPlw81z9JXvv5+AINHka9pCw9pdEZxBk+XZO7BspaiadOTHmWxjY2w75rfUTzGPlnREyRnadT7mfebRiFQL8XMXPzI86khmA6DJp4C6Qso/YuL7K0ZEL939UF/TEAZ5uGOR6eLiw=; 5:D1pzboRhLb8+p96X+R4CagFvy2BGqydDZ4MfRCnsXiZylrG08r2Gi4hvAKSRKpzq4Guk7VU+aHDYtIRjKi9xqeTgWnYVdy1WIJYU7rZcMW4k9rm4anf1HQTMNy/uro8w6sKraAXdA3RwGGN2wSvLlKk9yaKLyWIDK+awP+LVyFU=; 24:VlSzW1HYYmT35jr5FdkwqcojEvFOKC+MkUpXegto7ViK+9ZMKoQkjxYMxhUQMLGriEam2YWHGI0224hlSs9XkEgesjy0O12uciUwH+ACRQA=; 7:odrO4VgqdCl6UKl+My3uqOhWJ/Z4+TxltZIEy3pj8o15LoE9fyy3KDAK1C09mdzCwCijGn+So+m0NKd9uQwY9KTC4PFHVkTGIZj2yBDRVoFBzOCEKIuvR9Tzew0TjO1eo5aT/C/mKa1vlbqOMW8mzY5QmB5R4Qo1htmp9TlQzkYMBr4OZ6gvymg3E291uhy+a43PQDEgG+1/GOPBAslirq7qznqEBUpsoX14yZBd3mYlqp8DpP9nrOImzaIk/ygG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2017 23:02:49.7449 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9dffaeb7-6b10-4cb6-5aee-08d526fcd5b0 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR02MB3384 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.37.85 Subject: [Qemu-devel] [PATCH v4 39/45] hw/usb: Replace fprintf(stderr, "*\n" with error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, Gerd Hoffmann , armbru@redhat.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Replace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed. find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + Some lines where then manually tweaked to pass checkpatch. The debug prints in usb_net_handle_control() where reverted to use fprintf(stderr, and usb_mtp_cancel_packet() now uses g_assert_not_reached(). Signed-off-by: Alistair Francis Cc: Gerd Hoffmann --- V3: - Use g_assert_not_reached() in usb_mtp_cancel_packet() - Leave the fprintf(stderr in usb_net_handle_control() V2: - Split hw patch into individual directories hw/usb/core.c | 15 ++++++++------- hw/usb/desc.c | 6 +++--- hw/usb/dev-audio.c | 39 ++++++++++++++++++++------------------- hw/usb/dev-bluetooth.c | 4 ++-- hw/usb/dev-mtp.c | 9 +++++---- hw/usb/dev-network.c | 14 +++++++------- hw/usb/hcd-ehci.c | 32 ++++++++++++++++---------------- hw/usb/hcd-musb.c | 4 ++-- hw/usb/hcd-xhci.c | 3 ++- hw/usb/host-legacy.c | 3 ++- 10 files changed, 67 insertions(+), 62 deletions(-) diff --git a/hw/usb/core.c b/hw/usb/core.c index 241ae66b15..9ffdef055c 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "qemu/iov.h" @@ -599,7 +600,7 @@ void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes) iov_from_buf(iov->iov, iov->niov, p->actual_length, ptr, bytes); break; default: - fprintf(stderr, "%s: invalid pid: %x\n", __func__, p->pid); + error_report("%s: invalid pid: %x", __func__, p->pid); abort(); } p->actual_length += bytes; @@ -681,7 +682,7 @@ void usb_ep_dump(USBDevice *dev) }; int ifnum, ep, first; - fprintf(stderr, "Device \"%s\", config %d\n", + error_report("Device \"%s\", config %d", dev->product_desc, dev->configuration); for (ifnum = 0; ifnum < 16; ifnum++) { first = 1; @@ -690,10 +691,10 @@ void usb_ep_dump(USBDevice *dev) dev->ep_in[ep].ifnum == ifnum) { if (first) { first = 0; - fprintf(stderr, " Interface %d, alternative %d\n", + error_report(" Interface %d, alternative %d", ifnum, dev->altsetting[ifnum]); } - fprintf(stderr, " Endpoint %d, IN, %s, %d max\n", ep, + error_report(" Endpoint %d, IN, %s, %d max", ep, tname[dev->ep_in[ep].type], dev->ep_in[ep].max_packet_size); } @@ -701,16 +702,16 @@ void usb_ep_dump(USBDevice *dev) dev->ep_out[ep].ifnum == ifnum) { if (first) { first = 0; - fprintf(stderr, " Interface %d, alternative %d\n", + error_report(" Interface %d, alternative %d", ifnum, dev->altsetting[ifnum]); } - fprintf(stderr, " Endpoint %d, OUT, %s, %d max\n", ep, + error_report(" Endpoint %d, OUT, %s, %d max", ep, tname[dev->ep_out[ep].type], dev->ep_out[ep].max_packet_size); } } } - fprintf(stderr, "--\n"); + error_report("--"); } struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep) diff --git a/hw/usb/desc.c b/hw/usb/desc.c index 85c15addc5..bde39e3903 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -1,5 +1,5 @@ #include "qemu/osdep.h" - +#include "qemu/error-report.h" #include "hw/usb.h" #include "hw/usb/desc.h" #include "trace.h" @@ -688,8 +688,8 @@ int usb_desc_get_descriptor(USBDevice *dev, USBPacket *p, break; default: - fprintf(stderr, "%s: %d unknown type %d (len %zd)\n", __func__, - dev->addr, type, len); + error_report("%s: %d unknown type %d (len %zd)", __func__, + dev->addr, type, len); break; } diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c index 343345235c..a95e4cdbd9 100644 --- a/hw/usb/dev-audio.c +++ b/hw/usb/dev-audio.c @@ -30,6 +30,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/desc.h" @@ -398,7 +399,7 @@ static int usb_audio_set_output_altset(USBAudioState *s, int altset) } if (s->debug) { - fprintf(stderr, "usb-audio: set interface %d\n", altset); + error_report("usb-audio: set interface %d", altset); } s->out.altset = altset; return 0; @@ -478,7 +479,7 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib, uint16_t vol = data[0] + (data[1] << 8); if (s->debug) { - fprintf(stderr, "usb-audio: vol %04x\n", (uint16_t)vol); + error_report("usb-audio: vol %04x", (uint16_t)vol); } vol -= 0x8000; @@ -496,8 +497,8 @@ static int usb_audio_set_control(USBAudioState *s, uint8_t attrib, if (set_vol) { if (s->debug) { - fprintf(stderr, "usb-audio: mute %d, lvol %3d, rvol %3d\n", - s->out.mute, s->out.vol[0], s->out.vol[1]); + error_report("usb-audio: mute %d, lvol %3d, rvol %3d", + s->out.mute, s->out.vol[0], s->out.vol[1]); } AUD_set_volume_out(s->out.voice, s->out.mute, s->out.vol[0], s->out.vol[1]); @@ -514,9 +515,9 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, int ret = 0; if (s->debug) { - fprintf(stderr, "usb-audio: control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n", - request, value, index, length); + error_report("usb-audio: control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x", + request, value, index, length); } ret = usb_desc_handle_control(dev, p, request, value, index, length, data); @@ -533,7 +534,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data); if (ret < 0) { if (s->debug) { - fprintf(stderr, "usb-audio: fail: get control\n"); + error_report("usb-audio: fail: get control"); } goto fail; } @@ -548,7 +549,7 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, length, data); if (ret < 0) { if (s->debug) { - fprintf(stderr, "usb-audio: fail: set control\n"); + error_report("usb-audio: fail: set control"); } goto fail; } @@ -557,9 +558,9 @@ static void usb_audio_handle_control(USBDevice *dev, USBPacket *p, default: fail: if (s->debug) { - fprintf(stderr, "usb-audio: failed control transaction: " - "request 0x%04x value 0x%04x index 0x%04x length 0x%04x\n", - request, value, index, length); + error_report("usb-audio: failed control transaction: " + "request 0x%04x value 0x%04x index 0x%04x length 0x%04x", + request, value, index, length); } p->status = USB_RET_STALL; break; @@ -581,7 +582,7 @@ static void usb_audio_handle_reset(USBDevice *dev) USBAudioState *s = USB_AUDIO(dev); if (s->debug) { - fprintf(stderr, "usb-audio: reset\n"); + error_report("usb-audio: reset"); } usb_audio_set_output_altset(s, ALTSET_OFF); } @@ -595,8 +596,8 @@ static void usb_audio_handle_dataout(USBAudioState *s, USBPacket *p) streambuf_put(&s->out.buf, p); if (p->actual_length < p->iov.size && s->debug > 1) { - fprintf(stderr, "usb-audio: output overrun (%zd bytes)\n", - p->iov.size - p->actual_length); + error_report("usb-audio: output overrun (%zd bytes)", + p->iov.size - p->actual_length); } } @@ -611,9 +612,9 @@ static void usb_audio_handle_data(USBDevice *dev, USBPacket *p) p->status = USB_RET_STALL; if (s->debug) { - fprintf(stderr, "usb-audio: failed data transaction: " - "pid 0x%x ep 0x%x len 0x%zx\n", - p->pid, p->ep->nr, p->iov.size); + error_report("usb-audio: failed data transaction: " + "pid 0x%x ep 0x%x len 0x%zx", + p->pid, p->ep->nr, p->iov.size); } } @@ -622,7 +623,7 @@ static void usb_audio_unrealize(USBDevice *dev, Error **errp) USBAudioState *s = USB_AUDIO(dev); if (s->debug) { - fprintf(stderr, "usb-audio: destroy\n"); + error_report("usb-audio: destroy"); } usb_audio_set_output_altset(s, ALTSET_OFF); diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index 0bbceaea0b..dfef258dca 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -274,13 +274,13 @@ static void usb_bt_fifo_enqueue(struct usb_hci_in_fifo_s *fifo, if (off <= DFIFO_LEN_MASK) { if (off + len > DFIFO_LEN_MASK + 1 && (fifo->dsize = off + len) > (DFIFO_LEN_MASK + 1) * 2) { - fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); + error_report("%s: can't alloc %i bytes", __func__, len); exit(-1); } buf = fifo->data + off; } else { if (fifo->dlen > fifo->dsize) { - fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len); + error_report("%s: can't alloc %i bytes", __func__, len); exit(-1); } buf = fifo->data + off - fifo->dsize; diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 94c2e94f10..69e2eac259 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include #include @@ -546,7 +547,7 @@ static void inotify_watchfn(void *arg) break; default: - fprintf(stderr, "usb-mtp: failed to parse inotify event\n"); + error_report("usb-mtp: failed to parse inotify event"); continue; } @@ -617,7 +618,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o) #ifdef CONFIG_INOTIFY1 int watchfd = usb_mtp_add_watch(s->inotifyfd, o->path); if (watchfd == -1) { - fprintf(stderr, "usb-mtp: failed to add watch for %s\n", o->path); + error_report("usb-mtp: failed to add watch for %s", o->path); } else { trace_usb_mtp_inotify_event(s->dev.addr, o->path, 0, "Watch Added"); @@ -1144,7 +1145,7 @@ static void usb_mtp_command(MTPState *s, MTPControl *c) usb_mtp_object_alloc(s, s->next_handle++, NULL, s->root); #ifdef CONFIG_INOTIFY1 if (usb_mtp_inotify_init(s)) { - fprintf(stderr, "usb-mtp: file monitoring init failed\n"); + error_report("usb-mtp: file monitoring init failed"); } #endif break; @@ -1348,7 +1349,7 @@ static void usb_mtp_handle_control(USBDevice *dev, USBPacket *p, static void usb_mtp_cancel_packet(USBDevice *dev, USBPacket *p) { /* we don't use async packets, so this should never be called */ - fprintf(stderr, "%s\n", __func__); + g_assert_not_reached(); } static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 85fc81bf43..7245182467 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -815,7 +815,7 @@ static int ndis_query(USBNetState *s, uint32_t oid, return sizeof(le32); default: - fprintf(stderr, "usbnet: unknown OID 0x%08x\n", oid); + error_report("usbnet: unknown OID 0x%08x", oid); return 0; } return -1; @@ -1120,9 +1120,9 @@ static void usb_net_handle_control(USBDevice *dev, USBPacket *p, default: fail: - fprintf(stderr, "usbnet: failed control transaction: " - "request 0x%x value 0x%x index 0x%x length 0x%x\n", - request, value, index, length); + error_report("usbnet: failed control transaction: " + "request 0x%x value 0x%x index 0x%x length 0x%x", + request, value, index, length); p->status = USB_RET_STALL; break; } @@ -1190,7 +1190,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p) uint32_t len; #ifdef TRAFFIC_DEBUG - fprintf(stderr, "usbnet: data out len %zu\n", p->iov.size); + error_report("usbnet: data out len %zu", p->iov.size); iov_hexdump(p->iov.iov, p->iov.niov, stderr, "usbnet", p->iov.size); #endif @@ -1260,8 +1260,8 @@ static void usb_net_handle_data(USBDevice *dev, USBPacket *p) } if (p->status == USB_RET_STALL) { - fprintf(stderr, "usbnet: failed data transaction: " - "pid 0x%x ep 0x%x len 0x%zx\n", + error_report("usbnet: failed data transaction: " + "pid 0x%x ep 0x%x len 0x%zx", p->pid, p->ep->nr, p->iov.size); } } diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index 0134232627..e405b882fb 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -419,7 +419,7 @@ static int ehci_get_pid(EHCIqtd *qtd) case 2: return USB_TOKEN_SETUP; default: - fprintf(stderr, "bad token\n"); + error_report("bad token"); return 0; } } @@ -1033,7 +1033,7 @@ static void ehci_opreg_write(void *ptr, hwaddr addr, /* not supporting dynamic frame list size at the moment */ if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) { - fprintf(stderr, "attempt to set frame list size -- value %d\n", + error_report("attempt to set frame list size -- value %d", (int)val & USBCMD_FLS); val &= ~USBCMD_FLS; } @@ -1190,7 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p) while (bytes > 0) { if (cpage > 4) { - fprintf(stderr, "cpage out of range (%d)\n", cpage); + error_report("cpage out of range (%d)", cpage); qemu_sglist_destroy(&p->sgl); return -1; } @@ -1296,7 +1296,7 @@ static void ehci_execute_complete(EHCIQueue *q) break; default: /* should not be triggerable */ - fprintf(stderr, "USB invalid response %d\n", p->packet.status); + error_report("USB invalid response %d", p->packet.status); g_assert_not_reached(); break; } @@ -1345,7 +1345,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->async == EHCI_ASYNC_INITIALIZED); if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) { - fprintf(stderr, "Attempting to execute inactive qtd\n"); + error_report("Attempting to execute inactive qtd"); return -1; } @@ -1383,7 +1383,7 @@ static int ehci_execute(EHCIPacket *p, const char *action) p->packet.actual_length); if (p->packet.actual_length > BUFF_SIZE) { - fprintf(stderr, "ret from usb_handle_packet > BUFF_SIZE\n"); + error_report("ret from usb_handle_packet > BUFF_SIZE"); return -1; } @@ -1461,7 +1461,7 @@ static int ehci_process_itd(EHCIState *ehci, case USB_RET_SUCCESS: break; default: - fprintf(stderr, "Unexpected iso usb result: %d\n", + error_report("Unexpected iso usb result: %d", ehci->ipacket.status); /* Fall through */ case USB_RET_IOERROR: @@ -1564,7 +1564,7 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async) /* section 4.8, only QH in async schedule */ if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) { - fprintf(stderr, "non queue head request in async schedule\n"); + error_report("non queue head request in async schedule"); return -1; } @@ -1586,8 +1586,8 @@ static int ehci_state_fetchentry(EHCIState *ehci, int async) default: /* TODO: handle FSTN type */ - fprintf(stderr, "FETCHENTRY: entry at %X is of type %d " - "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry)); + error_report("FETCHENTRY: entry at %X is of type %d " + "which is not supported yet", entry, NLPTR_TYPE_GET(entry)); return -1; } @@ -2086,7 +2086,7 @@ static void ehci_advance_state(EHCIState *ehci, int async) break; default: - fprintf(stderr, "Bad state!\n"); + error_report("Bad state!"); again = -1; g_assert_not_reached(); break; @@ -2094,7 +2094,7 @@ static void ehci_advance_state(EHCIState *ehci, int async) if (again < 0 || itd_count > 16) { /* TODO: notify guest (raise HSE irq?) */ - fprintf(stderr, "processing error - resetting ehci HC\n"); + error_report("processing error - resetting ehci HC"); ehci_reset(ehci); again = 0; } @@ -2151,8 +2151,8 @@ static void ehci_advance_async_state(EHCIState *ehci) default: /* this should only be due to a developer mistake */ - fprintf(stderr, "ehci: Bad asynchronous state %d. " - "Resetting to active\n", ehci->astate); + error_report("ehci: Bad asynchronous state %d. " + "Resetting to active", ehci->astate); g_assert_not_reached(); } } @@ -2201,8 +2201,8 @@ static void ehci_advance_periodic_state(EHCIState *ehci) default: /* this should only be due to a developer mistake */ - fprintf(stderr, "ehci: Bad periodic state %d. " - "Resetting to active\n", ehci->pstate); + error_report("ehci: Bad periodic state %d. " + "Resetting to active", ehci->pstate); g_assert_not_reached(); } } diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c index d70a91a58c..4729926124 100644 --- a/hw/usb/hcd-musb.c +++ b/hw/usb/hcd-musb.c @@ -253,8 +253,8 @@ /* #define MUSB_DEBUG */ #ifdef MUSB_DEBUG -#define TRACE(fmt, ...) fprintf(stderr, "%s@%d: " fmt "\n", __func__, \ - __LINE__, ##__VA_ARGS__) +#define TRACE(fmt, ...) error_report("%s@%d: " fmt "", __func__, \ + __LINE__, ##__VA_ARGS__) #else #define TRACE(...) #endif diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index af3a9d88de..14f4f455a0 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -19,6 +19,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/hw.h" #include "qemu/timer.h" #include "qemu/queue.h" @@ -39,7 +40,7 @@ #else #define DPRINTF(...) do {} while (0) #endif -#define FIXME(_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ +#define FIXME(_msg) do { error_report("FIXME %s:%d %s", \ __func__, __LINE__, _msg); abort(); } while (0) #define TRB_LINK_LIMIT 32 diff --git a/hw/usb/host-legacy.c b/hw/usb/host-legacy.c index 3b57e21b52..56865c40ed 100644 --- a/hw/usb/host-legacy.c +++ b/hw/usb/host-legacy.c @@ -34,6 +34,7 @@ #include "qemu-common.h" #include "hw/usb.h" #include "hw/usb/host.h" +#include "qemu/error-report.h" /* * Autoconnect filter @@ -86,7 +87,7 @@ static int parse_filter(const char *spec, struct USBAutoFilter *f) } if (i < DEV) { - fprintf(stderr, "husb: invalid auto filter spec %s\n", spec); + error_report("husb: invalid auto filter spec %s", spec); return -1; }