From patchwork Tue Dec 15 10:43:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 41173 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E1B44B7CB0 for ; Tue, 15 Dec 2009 21:43:59 +1100 (EST) Received: from localhost ([127.0.0.1]:37460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKUsm-0000Cs-5Z for incoming@patchwork.ozlabs.org; Tue, 15 Dec 2009 05:43:56 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NKUs6-0000BF-OU for qemu-devel@nongnu.org; Tue, 15 Dec 2009 05:43:14 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NKUs1-000072-3I for qemu-devel@nongnu.org; Tue, 15 Dec 2009 05:43:13 -0500 Received: from [199.232.76.173] (port=37882 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKUs0-00006s-QQ for qemu-devel@nongnu.org; Tue, 15 Dec 2009 05:43:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25242) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NKUs0-0000Me-D4 for qemu-devel@nongnu.org; Tue, 15 Dec 2009 05:43:08 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBFAh7he014748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 15 Dec 2009 05:43:07 -0500 Received: from zweiblum.home.kraxel.org (vpn2-9-197.ams2.redhat.com [10.36.9.197]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBFAh5nS013712; Tue, 15 Dec 2009 05:43:06 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 51AB170FB8; Tue, 15 Dec 2009 11:43:04 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 15 Dec 2009 11:43:02 +0100 Message-Id: <1260873782-21473-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [FOR 0.12 PATCH] usb-host: check mon before using it. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- usb-linux.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 105ce88..88728e9 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1206,7 +1206,8 @@ static int usb_host_read_file(char *line, size_t line_size, const char *device_f ret = 1; #if 0 } else { - monitor_printf(mon, "husb: could not open %s\n", filename); + if (mon) + monitor_printf(mon, "husb: could not open %s\n", filename); #endif } @@ -1339,15 +1340,17 @@ static int usb_host_scan(void *opaque, USBScanFunc *func) } found_devices: if (!usb_fs_type) { - monitor_printf(mon, "husb: unable to access USB devices\n"); + if (mon) + monitor_printf(mon, "husb: unable to access USB devices\n"); return -ENOENT; } /* the module setting (used later for opening devices) */ usb_host_device_path = qemu_mallocz(strlen(devpath)+1); strcpy(usb_host_device_path, devpath); - monitor_printf(mon, "husb: using %s file-system with %s\n", - fs_type[usb_fs_type], usb_host_device_path); + if (mon) + monitor_printf(mon, "husb: using %s file-system with %s\n", + fs_type[usb_fs_type], usb_host_device_path); } switch (usb_fs_type) {