From patchwork Mon Nov 20 21:32:39 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: 745388 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1533540wrt; Mon, 20 Nov 2023 13:36:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFss39kZvv0aKxiTSfyf8LkJHbi/0n+vDVuC3BfkKQMXCM0ihH8AanAuXDT1FTC8pYfm7Fd X-Received: by 2002:ac8:5986:0:b0:419:5b6c:be62 with SMTP id e6-20020ac85986000000b004195b6cbe62mr14172924qte.4.1700516196666; Mon, 20 Nov 2023 13:36:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700516196; cv=none; d=google.com; s=arc-20160816; b=TGJoIg6Y2AB5gqdmHbN0YXjtr/q7GHguNQ8HVY5bXnWVEt2h56q0GyKx6Q+gjCnusA Ch4G+MVk79/pT5zZo8sgxEnByjlKFgXbDemLYuIitk/r1dQE+34G6cOv+eocserGlUkr OEzwRHA9ndRoay2/UdNz0aeTRenmZkR+xLJSlezPtMShkh7zONbyMmw1aKBk4lgA6ufQ v0sPLmvepV/F/k+fxdqOO2dZBcQRR4T9FQXLWfKksDjQfQRropICfbC0QkR9+VoxHIUF BV5w+NAss89NR/H24OQ+GhJwyAcXJfbBFIJPzjnek77a8FwvG0oTA3SYzJvRXDzkWxsl +vng== 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=Q5q8QrKQWuc5ZJauQIVd7Hh9PAH4SP4rAcWXs3pwmqE=; fh=toXMQ9nuJ3L4CLQ8EKaTQ8L/ltDlD3GauRZSJpgYVzU=; b=0OmZUc9NdraMKe9a060n2a7/zCnx9j4pqqpAnXiQOdPxK1xuBE03nXS4P6yLP6/Tvb 7IelY02HSryP09vfmi2vMLmuFzO1D3KnNvueV4q/XbtR2Q9yvTEAnwNmZgdiNkL4TMaV yQuVdQ2vrjdsCGADFNYruIe/xj/nYe3pf5VtAF5k4Z3fWIIvA1vlDUAgIkZltErW5cmF IAtEPknt+Nft9dG2+miO81jbQELRQocpUkbx5SKVnTW5Bsnz8jWGMunRNE+7PKYcRlJt ZvpgS1zp9hu15YLIP1AUQTOs6yeGk/ScfgfpITGoX5suj+VA4NKqoKKs2zdMgxVDHIIK 8YZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jCWV1wbk; 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 w20-20020ac87e94000000b00420f1b907adsi7967623qtj.200.2023.11.20.13.36.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 13:36:36 -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=jCWV1wbk; 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 1r5Bu4-0001K4-UJ; Mon, 20 Nov 2023 16:34:00 -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 1r5Bu3-0001J3-IJ for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:33:59 -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 1r5Bu0-0003Iy-IU for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:33:59 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4084de32db5so23400665e9.0 for ; Mon, 20 Nov 2023 13:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700516035; x=1701120835; 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=Q5q8QrKQWuc5ZJauQIVd7Hh9PAH4SP4rAcWXs3pwmqE=; b=jCWV1wbkyERg6hF35VqiCyW8CUpdsYYaWQBOV9YfJziIQCJ3CPACMs4bhVDav5Lp7b wFXvwevdIgCfNyG+ok/+nk4vdfXfPfDHOixuqlDuAw4MsfTGxshHhMSg+xR7f3QpSCF1 uEVK95K4NOiRw+TSfx7wJP5Ut6lZm5duCixsDu8c6FEuEDts84a+na6qbT4X4wU3DSUJ 3hcoMjzt8yqlLSEeva2+kOsa3tJVXbMC8XG7UymB2xcx0hpW7aDldYSYdjMY2INq9UmZ UDI3fvrRb1O+FK+zDMrZpVroo7b+6Dy0x2s0UM+wL4G23JuMRasssW6MEpNrchorOFwK OYfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700516035; x=1701120835; 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=Q5q8QrKQWuc5ZJauQIVd7Hh9PAH4SP4rAcWXs3pwmqE=; b=LUqQNspU+uWy+Tmfhm4cclpW3fO1KX1/MQ02+dYxpc61wkROETEiPL9NuReJjmrYXq Xh4iXk4K5qfjo3aTu9f57pR0JIfpqmFxjXiMhUZIiaWw6gwb7XmPZAr3Lx0dMglGukZb /MbPZ6xNNNUUDS9DujKOX36dusi8ys/02cOIZxZKZ/Z2q6jWXQ0RdVZoTKj/cVgQ+kNT 2RTO+qS4g5dK04AK3hzRTlk36LwTSYYaI9ZyM2WUrNYn/CtTJUDTwhIgAu7IE/PqnNtc uklnP04BrHfyb4ro9BsneB6XHudZ1txe8WdkutqKZkE2sIBpNSTPuJp0rYNUxdkkqQ+g 0rHQ== X-Gm-Message-State: AOJu0Yzqc+h9llRU13UroxmpV0GBcHWAWTjOQAUNBkO3ujDIvEVZG6vS bX8XuMfmq3jPDw4XDW9D+LQj9yAIJEn8N8VG8v0= X-Received: by 2002:a7b:cd14:0:b0:408:3804:2a20 with SMTP id f20-20020a7bcd14000000b0040838042a20mr6807648wmj.22.1700516035088; Mon, 20 Nov 2023 13:33:55 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id a3-20020a05600c348300b0040a5e69482esm19351694wmq.11.2023.11.20.13.33.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 13:33:54 -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 05/25] memory: Simplify memory_region_init_ram_from_fd() calls Date: Mon, 20 Nov 2023 22:32:39 +0100 Message-ID: <20231120213301.24349-6-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::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_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, arg7, errp; @@ - memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, &errp); if ( - errp + !memory_region_init_ram_from_fd(mr, owner, arg3, arg4, arg5, arg6, arg7, &errp) ) { ... return; } and removing the local Error variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Manos Pitsidianakis Reviewed-by: Gavin Shan --- system/memory.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/system/memory.c b/system/memory.c index 2fe4c3861b..ca05c4defa 100644 --- a/system/memory.c +++ b/system/memory.c @@ -3604,11 +3604,8 @@ void memory_region_init_ram(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; - Error *err = NULL; - memory_region_init_ram_nomigrate(mr, owner, name, size, &err); - if (err) { - error_propagate(errp, err); + if (!memory_region_init_ram_nomigrate(mr, owner, name, size, errp)) { return; } /* This will assert if owner is neither NULL nor a DeviceState.