From nobody Wed Nov 27 20:51:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=1697378705; cv=none; d=zohomail.com; s=zohoarc; b=nspZ5BAvil0wSb7wLCgWLCqA4HB6D8whSGsPE5ph0XcIhQITyQvIg7gsCkV4m4pTnTdYPCtdaC8DPEq+quxuCBKwWKdjSGZRBf7Um6v9aOczTvcrKoU2WM/DlHUg+pjQ/fEVUTBR738UQ4ka6AMUiIX31a3/FEsRbixkesKavdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697378705; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:Message-Id:Reply-To:To; bh=d18/i97hlUr6Onmf2G/5q9eDcQFElLasqCEeRxQVnvg=; b=cbMx0aCypaPTaLn+XFK2olpO+MMz8BArqxuMyspM/8RK3/7exmO62Wh2ykNfFmnkFZCbkVnmGBsIw6O0g9Yw1ekKtbqWw3l69AJU3cqZcTqwhxV69ckhOP5ILDTBiDMcUh7oNCzY9qx7yXI0CUseJ0F/cYcnO6XdzN7pDxU6gzo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1697378705397532.9478559514853; Sun, 15 Oct 2023 07:05:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qs1jA-000347-7a; Sun, 15 Oct 2023 10:04:20 -0400 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 1qs1j2-0002tX-Tr for qemu-devel@nongnu.org; Sun, 15 Oct 2023 10:04:13 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qs1j0-0007tu-Ic for qemu-devel@nongnu.org; Sun, 15 Oct 2023 10:04:11 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1c9e95aa02dso20406805ad.0 for ; Sun, 15 Oct 2023 07:04:10 -0700 (PDT) Received: from localhost ([2400:4050:a840:1e00:78d2:b862:10a7:d486]) by smtp.gmail.com with UTF8SMTPSA id x19-20020a170902ea9300b001bf6ea340a9sm6862464plb.159.2023.10.15.07.04.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Oct 2023 07:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1697378649; x=1697983449; 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=d18/i97hlUr6Onmf2G/5q9eDcQFElLasqCEeRxQVnvg=; b=TKml3dd6o4cIGYJvc//Qf9Yg6ZNGhpwMTnSp5I9aBM3geosFo6ceFlXrBH6M4D+oXd FT2YQXBBSt8qrW64AZJBY0+Qb3q4RkDioSx7UiFJGGY/ObGpuTrpFNA0BUMVggiY8QoY xAofTzlmH7itJZWEmn7/xcojdOajYRChWYdBraUt1HmAxAih+3xDlhEnk0Av+UPDMy9c Ba8n4GydIkoXnWbRtbrV+91NfDAyoB36ipNSx1p+UXDZmUJhC3J8Eo09dss9WzSzQ6eS UvX4Ql4SVtoudYkiR9WRmoB/hKdgb+v3bi3JOaDgDRzfs3rFhYknlgwctI+XOD+nEX54 SZLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697378649; x=1697983449; 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=d18/i97hlUr6Onmf2G/5q9eDcQFElLasqCEeRxQVnvg=; b=HamU5RQDcF4D0gwn8XetVeNvte0VrwWbeuRjsI97gN73ydol93bSwkx4XiXUEcN8J0 iGw8sr52YO5rNIeqAMCrB+Bras5fLOsoV+TTNuavL3pyFFTzRVzqZ2bPKMXWh2jOhT81 bfe3tdQrLHILs+dlU/ShYyNmCkANjku1L+tWBU1AISR5+7HJu+kQCxIyvXCCt43FmxMj pglGourjZctQ0mW/cO/5yDjWjAhFLe0r36uzTIv3TDJG4eycbYu1k+RGj2l1BWEs3/Bw k/nPWXUn7TglXODCDAywpjblPBIV6fQXC9OIG6V2wXQpPkM+j/TiuvewH2t2E7ONvdJW s75A== X-Gm-Message-State: AOJu0YyuXKG3QHyyJq9UDjxgjo3LMWfIOIyqRRAxAyhdVA1WoAk0Qz7T PD03wbMvO3KpgUykTnAMKjwX8ALvZ50q8QaNK4m/fA== X-Google-Smtp-Source: AGHT+IHG0fIIBGa6QLUD5MiLykhGTDybdggz4W4auRjekS8GLxpWFqX06EerxgJkn41A8fwlw0OfZg== X-Received: by 2002:a17:903:434d:b0:1bd:e258:a256 with SMTP id lo13-20020a170903434d00b001bde258a256mr6253864plb.32.1697378649225; Sun, 15 Oct 2023 07:04:09 -0700 (PDT) From: Akihiko Odaki To: Cc: qemu-devel@nongnu.org, Yuri Benditovich , Andrew Melnychenko , "Michael S . Tsirkin" , Jason Wang , Akihiko Odaki Subject: [PATCH v4 17/20] ebpf: Simplify error handling Date: Sun, 15 Oct 2023 23:02:49 +0900 Message-ID: <20231015140259.259434-18-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231015140259.259434-1-akihiko.odaki@daynix.com> References: <20231015140259.259434-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: none client-ip=2607:f8b0:4864:20::62c; envelope-from=akihiko.odaki@daynix.com; helo=mail-pl1-x62c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @daynix-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1697378706275100001 Content-Type: text/plain; charset="utf-8" The error handling procedures required when rss_bpf__open() and rss_bpf__load(rss_bpf_ctx) are different so it's better to implement them separately. Signed-off-by: Akihiko Odaki --- ebpf/ebpf_rss.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c index fe3184fed9..56c518c604 100644 --- a/ebpf/ebpf_rss.c +++ b/ebpf/ebpf_rss.c @@ -46,12 +46,13 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx) rss_bpf_ctx =3D rss_bpf__open(); if (rss_bpf_ctx =3D=3D NULL) { trace_ebpf_error("eBPF RSS", "can not open eBPF RSS object"); - goto error; + return false; } =20 if (rss_bpf__load(rss_bpf_ctx)) { trace_ebpf_error("eBPF RSS", "can not load RSS program"); - goto error; + rss_bpf__destroy(rss_bpf_ctx); + return false; } =20 ctx->obj =3D rss_bpf_ctx; @@ -65,11 +66,6 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx) rss_bpf_ctx->maps.tap_rss_map_toeplitz_key); =20 return true; -error: - rss_bpf__destroy(rss_bpf_ctx); - ctx->obj =3D NULL; - - return false; } =20 static void ebpf_rss_set_config(struct EBPFRSSContext *ctx, --=20 2.42.0