From nobody Sun Apr 28 08:56:42 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1503076176430718.3549887722951; Fri, 18 Aug 2017 10:09:36 -0700 (PDT) Received: from localhost ([::1]:42141 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dikm7-0005Sv-4q for importer@patchew.org; Fri, 18 Aug 2017 13:09:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dikl1-0004qb-JG for qemu-devel@nongnu.org; Fri, 18 Aug 2017 13:08:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dikl0-0003Rw-N5 for qemu-devel@nongnu.org; Fri, 18 Aug 2017 13:08:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58100) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dikkv-0003Pv-9d; Fri, 18 Aug 2017 13:08:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 524B7C0587E6; Fri, 18 Aug 2017 17:08:20 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-116-94.ams2.redhat.com [10.36.116.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBF64784B3; Fri, 18 Aug 2017 17:08:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 524B7C0587E6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=thuth@redhat.com From: Thomas Huth To: Beniamino Galvani , Peter Maydell Date: Fri, 18 Aug 2017 19:08:16 +0200 Message-Id: <1503076096-14220-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 18 Aug 2017 17:08:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] hw/arm/allwinner: Fix crash with -nodefaults -M cubieboard 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: qemu-arm@nongnu.org, qemu-devel@nongnu.org, Li Guang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The allwinner-a10 device uses serial_hds[0] without checking whether it is available or not. So using the cubieboard with -nodefaults currently results in a segmentation fault. Fix it by adding a proper check here. And while we're at it, mark the device as "user_creatable =3D false" since this apparently can not directly be used by the users but has to be wired up in code instead. Signed-off-by: Thomas Huth --- hw/arm/allwinner-a10.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index f62a9a3..e152566 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -109,8 +109,10 @@ static void aw_a10_realize(DeviceState *dev, Error **e= rrp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0, s->irq[56]); =20 /* FIXME use a qdev chardev prop instead of serial_hds[] */ - serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, s->irq[1= ], - 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); + if (serial_hds[0]) { + serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, s->i= rq[1], + 115200, serial_hds[0], DEVICE_NATIVE_ENDIAN); + } } =20 static void aw_a10_class_init(ObjectClass *oc, void *data) @@ -118,6 +120,8 @@ static void aw_a10_class_init(ObjectClass *oc, void *da= ta) DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D aw_a10_realize; + /* Reason: Needs to be wired up in code, see cubieboard_init() */ + dc->user_creatable =3D false; } =20 static const TypeInfo aw_a10_type_info =3D { --=20 1.8.3.1