From patchwork Fri Jan 5 15:42:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 760204 Delivered-To: patch@linaro.org Received: by 2002:a5d:678d:0:b0:336:6142:bf13 with SMTP id v13csp107915wru; Fri, 5 Jan 2024 07:54:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIrevc4jwQFrnSNvsRSZFSJY2uhQWNKG4Tho/6Jd9NyTogpt4FBkzJIAZcqsY1vM/IBoXH X-Received: by 2002:a05:6830:c3:b0:6dc:3ff:df52 with SMTP id x3-20020a05683000c300b006dc03ffdf52mr2245260oto.28.1704470061395; Fri, 05 Jan 2024 07:54:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704470061; cv=none; d=google.com; s=arc-20160816; b=ZdDWQQK+7u4UdAbfRAQ8Qd3giRqTl8DIdVKAVZdDIk58BkgzJMWqD6O9b3G2ncu8PM irwimGxNLYK5QuWotX+NYhn16H8hxjS937FQL61n69kzEpfONooNHgILsUcgzLqIdNWg 3U8J0yhTI4tN7xi+NX6HfBxfwg8TMpej4vS0P4uA+9TJTcx2AhzpGk36VYxUsVwBTFdP uYbrt08ZXMsNJcxCYq3VrPMxf+HA170oJY0lihWTxuidwXdyS8lp2wNoXyByHdfwIKFY MlmtNLFpGCjUULL2IzFm+OsUUHw2V65z23AKbKBlzw2P3WPqfh6UvlOQerwm1fhH8IqM tj/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PoxGR8z2iD4/dV7vlDevdlyqaz6yGMvGSLHUDaB/+Ko=; fh=blOP6cOSNCAbDKwnsy0Dgmm9z1Xj+QQhLO4S+72HReE=; b=tKhHbi1JmVJrtenOaf8/FZaSrGlC8mI1TDdC8m+NdMfzeklUK8dtSyHP/WxQRIih9u ZTtsQku91J1qPPZqqTwCmPqK1UlEy4UkZYq8KPoYNhSttWfYI3oqwfVJyCZ5Anei3CyO fja/SKgA0l6x7c7GC7Gwo052+D1qLSJAMrC5gmN2QkEC19fxOuEpr/B6kbMy5hbCs7fz J9ABgnx3yT1mH1zIGf2fNVbh3Y+vso3gKtV7sMr3yd4XuPYvkcLHKik7m0NfGpq2vxVM FeOsMEKDjQWchtjRGA/8KYnaKDUT7IP1eK7GpD9ci4TV5xFkzdRX2TJWD61QDWPAMvHm 0NTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lS7mHqvQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pb14-20020a05620a838e00b007811a26404bsi2156926qkn.768.2024.01.05.07.54.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Jan 2024 07:54:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lS7mHqvQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rLmTP-0002rg-DU; Fri, 05 Jan 2024 10:51:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rLmSI-0008MD-Fu for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:56 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rLmSB-0000xb-Ce for qemu-devel@nongnu.org; Fri, 05 Jan 2024 10:49:53 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-40d6b4e2945so18127645e9.0 for ; Fri, 05 Jan 2024 07:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704469786; x=1705074586; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PoxGR8z2iD4/dV7vlDevdlyqaz6yGMvGSLHUDaB/+Ko=; b=lS7mHqvQydw9G3Y95Kh+xSnAHmZcPK6Yh8lO6Q5C9+RCv/1NWXRQ4A55nbW9oDf4oQ 9aSJuVas4MVrsgWiIyEyzqfq+nyNySZfOtIC5N9GM+HXAHyfV/1Lho4v7IPKzpQkYaqr egKqoEs5pBlK1/60ZWAnVsBN2S0ysVpzIxlnweC/UHHMq7PIPpCNsERY2FDaavfUtJtP 4fTGLJ+fesB/gcydoGNKFrRiX3rH8XYdKuDJUZWh43hwFe66wwqDN7QzUPVMpt3zpFZ2 2kIM3RYtJYkES9osuoVYSZzPSHx2XaQg0UtO6rJ4wRa1uL157YP0fxCdqjJ2TwPoMP1L PcSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704469786; x=1705074586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PoxGR8z2iD4/dV7vlDevdlyqaz6yGMvGSLHUDaB/+Ko=; b=DhOhgTlhNaCvlWcyaSdzQ6R5HDbxlgvXKE9y9FDlVjgk0QDQ0ey2Bw1kKnz1C1s/TB PZqTi/U+w87xkMncPIOlHVhuRp5wxmiFHW1btmQQUoWllRHLdvHl+bh0P5Gf2wMBQbIF D/Gm74UTANVHGzxe44MnN8oQRnU/9aCnkLuI67ipoZZU8fP+ohNYG7vpfqmZygczukau Xz6LLUWHiJg1HOXZlx6T37/8+onBDS58+INxolkIHOLc57Ts9IMzJcuE+CyrojPFEzBC aO7EKwFz5xtliv9nYRQeuQbCcCxAQ2x6LWMrPLYZ6CAifpIcnrJsNCb8Rmqsz/ImfZEY TFEQ== X-Gm-Message-State: AOJu0YwmJG/UnpkKyPxCHsPULCvg3EuE/burt+n+95O4P6LdXGjt1LHo I4PmMKIC/ikH4j/h+bw+Xjt/ExG2dNOp0VE6snxOsPcm4vg= X-Received: by 2002:a05:600c:22d6:b0:40d:5d07:55d3 with SMTP id 22-20020a05600c22d600b0040d5d0755d3mr819881wmg.177.1704469785886; Fri, 05 Jan 2024 07:49:45 -0800 (PST) Received: from m1x-phil.lan (juv34-h02-176-184-26-1.dsl.sta.abo.bbox.fr. [176.184.26.1]) by smtp.gmail.com with ESMTPSA id b14-20020adff90e000000b003375c072fbcsm896486wrr.100.2024.01.05.07.49.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 05 Jan 2024 07:49:45 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-arm@nongnu.org, qemu-riscv@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gavin Shan , Mark Cave-Ayland , Artyom Tarasenko Subject: [PULL 65/71] hw/sparc: Simplify memory_region_init_ram_nomigrate() calls Date: Fri, 5 Jan 2024 16:42:58 +0100 Message-ID: <20240105154307.21385-66-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240105154307.21385-1-philmd@linaro.org> References: <20240105154307.21385-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Mechanical change using the following coccinelle script: @@ expression mr, owner, arg3, arg4, errp; @@ - memory_region_init_ram_nomigrate(mr, owner, arg3, arg4, &errp); if ( - errp + !memory_region_init_ram_nomigrate(mr, owner, arg3, arg4, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Gavin Shan Message-Id: <20231120213301.24349-23-philmd@linaro.org> --- hw/sparc/sun4m.c | 21 ++++++--------------- hw/sparc64/sun4u.c | 7 ++----- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 64895aebe3..550af01690 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -577,12 +577,9 @@ static void idreg_realize(DeviceState *ds, Error **errp) { IDRegState *s = MACIO_ID_REGISTER(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.idreg", - sizeof(idreg_data), &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.idreg", + sizeof(idreg_data), errp)) { return; } @@ -631,12 +628,9 @@ static void afx_realize(DeviceState *ds, Error **errp) { AFXState *s = TCX_AFX(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.afx", 4, - &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->mem, OBJECT(ds), "sun4m.afx", + 4, errp)) { return; } @@ -715,12 +709,9 @@ static void prom_realize(DeviceState *ds, Error **errp) { PROMState *s = OPENPROM(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4m.prom", - PROM_SIZE_MAX, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4m.prom", + PROM_SIZE_MAX, errp)) { return; } diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index c871170378..24d53bf5fd 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -454,12 +454,9 @@ static void prom_realize(DeviceState *ds, Error **errp) { PROMState *s = OPENPROM(ds); SysBusDevice *dev = SYS_BUS_DEVICE(ds); - Error *local_err = NULL; - memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4u.prom", - PROM_SIZE_MAX, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_nomigrate(&s->prom, OBJECT(ds), "sun4u.prom", + PROM_SIZE_MAX, errp)) { return; }