From patchwork Mon Nov 20 21:32:43 2023 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: 745393 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1534791wrt; Mon, 20 Nov 2023 13:40:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHHVJoR0Ur6B3TTt7zQERdBVG/lYFtfEu6+YKnr2NyE9Cy9vvjvSYKObskhPsU1wL1JhOZ X-Received: by 2002:a05:622a:612:b0:421:c864:1f7c with SMTP id z18-20020a05622a061200b00421c8641f7cmr9943402qta.36.1700516440097; Mon, 20 Nov 2023 13:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700516440; cv=none; d=google.com; s=arc-20160816; b=PutcMwusAsp7WTeUYrDCuk9IcB9+JgcpXXutTl9vVkA8cqOgxGP4mragOSRwfvw4Kk 0o29kQnwHecO74fTuCv57fDg0ZT/jRsmApeIBqiuWbGgyU2ntHMGDHnsYXBxGVpwf5bq cK/8GPLRBlg7B6hAt90RsYG3+qtZ0U8yyWK179qQk/HFEUnmAcjEiJ7dcm86zVUDvv+U d81Vl4VJQ9Bu1KQFVJSIZKyhhGcIwTJyCqjOarWGm3qC/WyuXK8kQnB7Wza+3CMmS1Il XUmDfOLgUeXFC95Ln3QcbVggOK8oFZe63N8s67NARFc6PuORmC9w8Sv6ZzQs4tUE88C+ WELA== 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=DIex8QjcVHMzUQGfRlZtiLonUpnm8G6I3FWEQ6zYP+4=; fh=toXMQ9nuJ3L4CLQ8EKaTQ8L/ltDlD3GauRZSJpgYVzU=; b=rDY1PwDRnwttsG91XPRp/xXqmEFa5U0q0c9sePyyuuIAjOTTpsLbeZpRVTrtVlxLhP cEDuTKxjC55Ui6Na7pHAFW1Ym+tWz4rccbpmE/wVSzxogykpkIaKSEbq7TJfD2MCwNu9 maVGQ0M3+q+xLBXS2818g3oT+REpxjnTeeGDYxkjRCMr3yspj3WA/kBMdb/QYYaKlHE1 MVtAIiJCm+tIMxDvXgRnalLUSFcSG/tZ38JoJy2bsQ+EIRToh3dmrYGyWPRQ3qdn2Pkk 9bnhGSF+cn691FwBOgrcStQM4yP88BPsoU1uJEuG4kuyFrFMg0T1mAGm93N9Ryyqi9Qo l5Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CFXuIQns; 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 v25-20020a05622a189900b00419a6207c03si8158477qtc.81.2023.11.20.13.40.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 13:40:40 -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=CFXuIQns; 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 1r5Bv8-0002sF-Fa; Mon, 20 Nov 2023 16:35:07 -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 1r5Buc-0001vy-Kt for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:34:35 -0500 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Bua-0003ao-Uz for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:34:34 -0500 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2c87903d314so26309481fa.1 for ; Mon, 20 Nov 2023 13:34:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700516066; x=1701120866; 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=DIex8QjcVHMzUQGfRlZtiLonUpnm8G6I3FWEQ6zYP+4=; b=CFXuIQnsSbbPfKf+1+Ki7L0fZ7WmHCfWo2WgW/tfU+ikZbqAJ6m8Oy0Wwjeyl97Gxq SrFoivpcSewRLeH1NXDfI4a6a4H7j2z8buwcrVrBssYP9P+Iim+tb3i4ctSrEeX7H7MJ 8+TfQudvl+vLXkQGPGHfyvAK3HFeIkevnz0UrVrPjbyqAvRkchaNo89VCKWbZmNUg86H dwxMRw5m2vcK6gmgAQI8hBff8ZU9C+ZTCFUfz51T0SM1DjuIxnKwoInxS9wa6nQrbmAp 9bnmQKBPsmQIAVzvO7twOCUpgW0tprSQBO+esxVpjI8t5zRlXjgYpi7AFhq/hEtn2L9J tZoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700516066; x=1701120866; 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=DIex8QjcVHMzUQGfRlZtiLonUpnm8G6I3FWEQ6zYP+4=; b=WIJUrNHMUR0pjn8v+ivLKBthhWoJn5DGnWLyKxkuS7V75DnRja1sJJgxHubjP6kfVL d36acLJ+xbRtM/mmAh5n26sVIjvIOMb8pDcrGZYJAjPw9iu4hrQOT6jcy1FMmC1GhyWM zCg2uydFOlTc7ovnBRZPPfaVtp7A6V6X3wogXnMS/HCHmcuj7mlyiQZ15vYNVco3i3RM K+vop5z+L4nNzZWijwdhwCmn/cAGVjG7eYPF03L/uhhlwsaEKocyhhS/yD8iP3MGQker kT14sQqaDh9PoQjG+cPSPcwFlG/xVYXJSIzdEtCJ6IGR91W+6rvUCSj+JUU9Q7LK7arJ 2wxA== X-Gm-Message-State: AOJu0YyayL6CioflM6QLRqHwMkXkj8lW6CpPEODngYY4f4qtb7xNtbDX SNl+a3FVdq74Gg3iFSAAQrcJCcD5pStf/f6XVfM= X-Received: by 2002:a05:651c:210:b0:2c0:20e3:990f with SMTP id y16-20020a05651c021000b002c020e3990fmr5660346ljn.10.1700516065839; Mon, 20 Nov 2023 13:34:25 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id t8-20020a05600c198800b0040531f5c51asm14963797wmq.5.2023.11.20.13.34.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 13:34:25 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: David Hildenbrand , Peter Maydell , "Michael S. Tsirkin" , qemu-arm@nongnu.org, Mark Cave-Ayland , Markus Armbruster , Paolo Bonzini , Igor Mammedov , qemu-ppc@nongnu.org, =?utf-8?q?C=C3=A9?= =?utf-8?q?dric_Le_Goater?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Peter Xu Subject: [PATCH-for-9.0 09/25] memory: Simplify memory_region_init_rom_device_nomigrate() calls Date: Mon, 20 Nov 2023 22:32:43 +0100 Message-ID: <20231120213301.24349-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231120213301.24349-1-philmd@linaro.org> References: <20231120213301.24349-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.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_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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, arg5, arg6, errp; @@ - memory_region_init_rom_device_nomigrate(mr, owner, arg3, arg4, arg5, arg6, &errp); if ( - errp + !memory_region_init_rom_device_nomigrate(mr, owner, arg3, arg4, arg5, arg6, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu Reviewed-by: Gavin Shan --- system/memory.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/system/memory.c b/system/memory.c index 1cccc4b755..6d1d315d0e 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3654,12 +3654,9 @@ void memory_region_init_rom_device(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; - Error *err = NULL; - memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, - name, size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, + name, size, errp)) { return; } /* This will assert if owner is neither NULL nor a DeviceState.