From patchwork Mon Nov 20 21:32:57 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: 745397 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1534994wrt; Mon, 20 Nov 2023 13:41:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7ikLrYWZD/IgYnE4U1i4NHbmlmOWB+dxK+HBxsMsT2W5rKW4JmSWeJepZ9JaqMg5xy7Df X-Received: by 2002:a05:6870:a451:b0:1ea:eed:fd02 with SMTP id n17-20020a056870a45100b001ea0eedfd02mr10499991oal.45.1700516474383; Mon, 20 Nov 2023 13:41:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700516474; cv=none; d=google.com; s=arc-20160816; b=GIDf/INP1xIU6oj614enXTJoAPYk8D9JwDqLcbwpcC67O6j/0z3XFRED+BKUStNzKi izCzPjt99gXTEsKjCX5c4wNJmoCfwk32YI+5iI/Yb58pzwctPtnyksYBVsfjazsTqquB E//zgdRlKH5RuX0cPdOawzo9ww11eDCTpFPXREmJiY1oJR1AP2824z1I2+8WuYFdzQL2 xZsYISA5fAh3XuxUoPhF0jiARouV48XnPdwo6pLOJTMMHsuyrkF7BYAWziBictRO0oVm D+icxhAlh8UYpLRFYv0ViMQ8yBqWiIPXtDrRxl7/QUV1LwzUn5OdCyaKI8cxmtfUkl1M 0WxQ== 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=LccZbSfVbRBJBP3hDaCoexHeaPDYfSMKOISo4dOr+pE=; fh=toXMQ9nuJ3L4CLQ8EKaTQ8L/ltDlD3GauRZSJpgYVzU=; b=yfXkMFvX55ycCNHdl8SRdyu6RC3BsgmHnfv0IG05ffd2Ny8dhO3dCUd70LsaGAl/DI aiJ570TGByjpa1eI/QrFWLD0Rn2VPWRAPQ0JztcQtERVzAnQVmCrnKwmdFomF+5cT+7P odLIoAYeOJ1lIVJ1A47QOn9ule2wL+2WYtT4cNxKC0s170CVggZDasw3hLdZQY1yA9Yy 2KQ+QHME8j2ppJotXIGsESqabJ9q+nVe5FVqcB2lojNzpPT0Ka1W0JwK7oHtK4JlccI9 OzmM3KWtMkFN+f4aRDODsIy6uzPiKNYjn8jxNZXQ+pBI21Kyf4gTo5fUke4zxO8JKXMH Gqiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MADWJtaX; 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 ew10-20020a05622a514a00b004236f259ac3si128039qtb.15.2023.11.20.13.41.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 13:41:14 -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=MADWJtaX; 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 1r5Byx-0003Zh-SD; Mon, 20 Nov 2023 16:39: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 1r5Byw-0003ZG-VU for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:39:03 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Byv-0004hC-DL for qemu-devel@nongnu.org; Mon, 20 Nov 2023 16:39:02 -0500 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-332c7d4a6a7so848313f8f.2 for ; Mon, 20 Nov 2023 13:39:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700516339; x=1701121139; 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=LccZbSfVbRBJBP3hDaCoexHeaPDYfSMKOISo4dOr+pE=; b=MADWJtaXVoHsCWOD+zESN/3a8CQwB8y6UkhtV7nLTVfXU3i2kP7GfweaI+eeaiQR3+ Frwu/P2NeKpWy9e4KUEAxvacAnGmHx1Q8+R4oNJh/nK8Vsm1Bz5sjCCXmbrkAUqpsUqk Ur19VJKguk4i8gqRs6TR8iyjj4PLZelZ0YKUJP/lQIIMty4mKWFdamF6egri1XG7bjy0 v9krfBWO3Zz1H9ACxpFWzMWCdbyauTAiarahT4BL8IxHDoDeKFeXkzh+Fm9aFhBcFvyA q0jYHHFpM6BRV824gmgzF3gvPhpucgOpZsnSocLyd0lpYktmZslluLmD2ZWbgYAOQLq3 nkCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700516339; x=1701121139; 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=LccZbSfVbRBJBP3hDaCoexHeaPDYfSMKOISo4dOr+pE=; b=td6QJmM/cms23XynU+Qx2/oGR9TRez5uQ7LPgxEWeVUeW+7F0dV+zx0rG4llv7SCTk nYMNlfGQBRdXF3sH73EnWwvoSGl6t7w4lKaXCl3xnmFV5iAkTFK40YtvavdO1t1AkzDu j8jHc7CRtf2GCWhAdSnRMkDayZ3QYXOhiyQpiwvbNQSfMFa0GT8imos+S+iOq3JIGiYp K2risk8rprsgBelq4BQWNqypFqTlAT/yBLHsN7VktpQYtVmsTjaZbAjs5pfIXZ5KPIS/ j4NXOy4NeEhMkjjAKw6mFwI1dbBw+njYr54LV9NcegLvxpZ/3oli7nhQn8MMQi42ilje WyKQ== X-Gm-Message-State: AOJu0YzmxBLVQuwBbAWOPJoWQ1Y25e0xTVSmpsnyGH39b6F34V8G7Zz8 1e+RETGXiwYPUdyj3ev3XJbvi5/TKDmIaP4dI94= X-Received: by 2002:a5d:59a3:0:b0:332:c4ce:5347 with SMTP id p3-20020a5d59a3000000b00332c4ce5347mr3132687wrr.48.1700516339396; Mon, 20 Nov 2023 13:38:59 -0800 (PST) Received: from m1x-phil.lan ([176.176.181.190]) by smtp.gmail.com with ESMTPSA id z4-20020a5d6404000000b0032fc5f5abafsm12233916wru.96.2023.11.20.13.38.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 20 Nov 2023 13:38:59 -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 23/25] hw/misc: Simplify memory_region_init_ram_from_fd() calls Date: Mon, 20 Nov 2023 22:32:57 +0100 Message-ID: <20231120213301.24349-24-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::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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 --- hw/misc/ivshmem.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 0447888029..9a8b9e2fd3 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -476,7 +476,6 @@ static void setup_interrupt(IVShmemState *s, int vector, Error **errp) static void process_msg_shmem(IVShmemState *s, int fd, Error **errp) { - Error *local_err = NULL; struct stat buf; size_t size; @@ -496,10 +495,9 @@ static void process_msg_shmem(IVShmemState *s, int fd, Error **errp) size = buf.st_size; /* mmap the region and map into the BAR2 */ - memory_region_init_ram_from_fd(&s->server_bar2, OBJECT(s), "ivshmem.bar2", - size, RAM_SHARED, fd, 0, &local_err); - if (local_err) { - error_propagate(errp, local_err); + if (!memory_region_init_ram_from_fd(&s->server_bar2, OBJECT(s), + "ivshmem.bar2", size, RAM_SHARED, + fd, 0, errp)) { return; }