From nobody Tue Feb 10 05:45:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1586196098; cv=none; d=zohomail.com; s=zohoarc; b=HDMAEZgpMzkyqdFS3jD75XCThneaNIUTaWaSx8jx3HOwO9LeT8wHk1Nfhs5I62iR6y+BMUM7bwvYmR4geNJKuV8uzvB8qYH6txKWM5B/I6QoGzSTJ5yK4vohhXys7hIK1KFJi3LlJDjbxMJconvcQPt8/UIiiEHQk63FlS3hTDo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586196098; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ACqwWM6q3w6eeeLf6eS/r0Fpb4qEkaBMb1O9yAVXZQo=; b=aOrtRNgopeGQgdHbPojSbk4uHX9yHQ+lyUuwzvqqqUn6mHpYZSXNnobPzsDg5AGCHZASfY/ke35u9//DWbzbxHK4PqWu3UNpjNogZA8h5YpcHQtPDAnlmPv2IYUW+XEICQ6mVKXw+pPxT7CPit+eUckYpygIKdkqpJuefZ2913g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586196098881327.3612409228813; Mon, 6 Apr 2020 11:01:38 -0700 (PDT) Received: from localhost ([::1]:36132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLW41-0000Xz-Ha for importer@patchew.org; Mon, 06 Apr 2020 14:01:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36153) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLVr3-0001yN-41 for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLVqu-00023J-98 for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:48:13 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:40882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jLVqu-0001x3-2H; Mon, 06 Apr 2020 13:48:04 -0400 Received: by mail-wr1-x42d.google.com with SMTP id s8so485999wrt.7; Mon, 06 Apr 2020 10:48:03 -0700 (PDT) Received: from x1w.redhat.com (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id a67sm364880wmc.30.2020.04.06.10.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 10:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ACqwWM6q3w6eeeLf6eS/r0Fpb4qEkaBMb1O9yAVXZQo=; b=YnlBvtszUzDdb+icZKReBOOOFv0y6kc3QKAP+hS9DENTtSQ52gd5dGpP83znPnHzcA uV6RdSFmkila64rigN1j+TaMTrTjwErg9MX7TL2DhlnXV0tB8V/GXKMABWy0yQTJ6UIT pFMj2U1J7EsZXj5pwii6wtZab5Xd5LeWhU8BuyXH+rtBimXkg4wci7ZpXn83xwyVSTqa wmjBFsgXTjlrPsGl36usaWNEQ/CmFdWf/wH9ctIB4T+g6qBkmi+5WqS6rAqYO0lROSci 4i8rrGmZar8XKfhxF2J5pq91RELY3N9yEpsGZdEpYv1Hkb/v47LKRp2UeHIIw/qxYZwY j2Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ACqwWM6q3w6eeeLf6eS/r0Fpb4qEkaBMb1O9yAVXZQo=; b=mlIdxf819pS+HLG60OApjJWtvpHvIXw2H6mqCstqZoZpTN08Js5WrVYLT8pEYVSfNW V9+layNmeKLJzTX3mLlPbAE1Rxc/b+daomCuDfWN3gkyedU4lOi9QUu4T0vw4tqrBo5B Wjk7/g5+XoJFTRaLjXYtqrN+sA3NhUmwQKhz+6YRSOSAIwj9eePC1u6UOwLd8sVxojX7 4NrbZuzEE9FIojCoQBkdLwC9mmIGYowVVqik9zHYwZgMnJpdlqqI2q8eni6MlSintzU7 kfbAlyUN+fpl/CnWH/rVUio2+kJCCm52YghBnmrB4VVOqbW0qJCWnjYDm1W3ydTmG0UK 7v/w== X-Gm-Message-State: AGi0PubA+IQoIIq6MDemv9tqhjJRsnFkrOIdIC9qczk0aVTU0BC1+ZCN lSn4pEkZAkWcjfcBHPZtpQh3CMLCuro= X-Google-Smtp-Source: APiQypI5qPfu9zlCCsgYeOd9oXnxsUMaKFlVxqollrYI+h70XiJmpExNDb7HscE6xSvZoEe+sSm4Iw== X-Received: by 2002:a5d:4649:: with SMTP id j9mr371222wrs.71.1586195282744; Mon, 06 Apr 2020 10:48:02 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Markus Armbruster Subject: [PATCH-for-5.1 v2 12/54] hw/arm/stm32f205_soc: Store MemoryRegion in STM32F205State Date: Mon, 6 Apr 2020 19:47:01 +0200 Message-Id: <20200406174743.16956-13-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200406174743.16956-1-f4bug@amsat.org> References: <20200406174743.16956-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Vladimir Sementsov-Ogievskiy , "open list:STM32F205" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Coccinelle reported: $ spatch ... --timeout 60 --sp-file \ scripts/coccinelle/simplify-init-realize-error_propagate.cocci HANDLING: ./hw/arm/stm32f205_soc.c >>> possible moves from stm32f205_soc_initfn() to stm32f205_soc_realize()= in ./hw/arm/stm32f205_soc.c:83 While reviewing we notice storing the MemoryRegion in the device state, we'll be able to later automatically simplify the error propagation calls. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/arm/stm32f205_soc.h | 4 ++++ hw/arm/stm32f205_soc.c | 18 +++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h index 922a733f88..63e7e7c825 100644 --- a/include/hw/arm/stm32f205_soc.h +++ b/include/hw/arm/stm32f205_soc.h @@ -56,6 +56,10 @@ typedef struct STM32F205State { =20 ARMv7MState armv7m; =20 + MemoryRegion sram; + MemoryRegion flash; + MemoryRegion flash_alias; + STM32F2XXSyscfgState syscfg; STM32F2XXUsartState usart[STM_NUM_USARTS]; STM32F2XXTimerState timer[STM_NUM_TIMERS]; diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 118c342559..42f4e44134 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -87,23 +87,19 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,= Error **errp) SysBusDevice *busdev; Error *err =3D NULL; int i; - MemoryRegion *system_memory =3D get_system_memory(); - MemoryRegion *sram =3D g_new(MemoryRegion, 1); - MemoryRegion *flash =3D g_new(MemoryRegion, 1); - MemoryRegion *flash_alias =3D g_new(MemoryRegion, 1); =20 - memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F205.flash", + memory_region_init_rom(&s->flash, OBJECT(dev_soc), "STM32F205.flash", FLASH_SIZE, &error_fatal); - memory_region_init_alias(flash_alias, OBJECT(dev_soc), - "STM32F205.flash.alias", flash, 0, FLASH_SIZE= ); + memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc), + "STM32F205.flash.alias", &s->flash, 0, FLASH_= SIZE); =20 - memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); - memory_region_add_subregion(system_memory, 0, flash_alias); + memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); + memory_region_add_subregion(system_memory, 0, &s->flash_alias); =20 - memory_region_init_ram(sram, NULL, "STM32F205.sram", SRAM_SIZE, + memory_region_init_ram(&s->sram, NULL, "STM32F205.sram", SRAM_SIZE, &error_fatal); - memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, sram); + memory_region_add_subregion(system_memory, SRAM_BASE_ADDRESS, &s->sram= ); =20 armv7m =3D DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 96); --=20 2.21.1