Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4050482rdg; Wed, 18 Oct 2023 13:28:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEI6Zqp7uTZolT0QQErWy0SYQARsqB4dO0lUHNECS1NAv5iTNR9YWiy9z/fPMMkpkJGNR6V X-Received: by 2002:a05:6870:3b16:b0:1e9:b2e2:8755 with SMTP id gh22-20020a0568703b1600b001e9b2e28755mr606350oab.42.1697660897363; Wed, 18 Oct 2023 13:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697660897; cv=none; d=google.com; s=arc-20160816; b=ldMvuS+TMisZG/O573JjcHq4HcfdGfNHO0Y8B3/NHIo/jboUV8otaYhxEbyp7oHdas g/lvDVvcS2bJ91hrN+NsD7EuPo4i7xT/EAiwxq7D+ie34hk47otqrqJdeANyj4U51vaK AAYZg4nSUq1LAwQjnVQ2Llg2SbUjhcVxs7GFRb7Hz4bt9KBWShYJCPdB8r0qQfE9Mv3f USg94lLqa5O8U00Gptcg3E1JSfpnKcOCyWWwIYnSzf8fvayEnk4bu655438xtqeJuj8t vTS9Kd37dJvFCGqV2eY00+b/m+ivpj6WIbvGTvLGpCC/Pb5JQ55xzfGk2iLlfioKSlVY Qgmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6mUSbOUoaHS+Vwf1kLbLX8Q2NHo1Zihtst0L/Wt8p10=; fh=SyD2M+pRKkzHV5ojkm/537HJTx8M6EWb9+t8YPZNc44=; b=hV9xXZhfIYYkrnqbyJKS0/lqry2d1AwiGgBCbywcqN86g7Ttly760xtOaHFdrzs5YZ dmkYYzDjZTKTUbWOLyh7YO26lp451yEgoD/Cyt90AQFbL1tpgjMkVGhmbyIEcmZFom/E mix2DTbPX+ejTrE8NeOudBj8Zt05PbjrAb3nJQF5uKKeGmUqKeVmvTCctpLcTpIzEUzA THhuzusDSGIE11gNfeSWdA+YAH79/073PGpxjeAuBJXVR9uEXFEQ0AnArtdzDVfHZ54K W3J19b/3EA77W2xy5TgGlKDThNvvYPSyMPvXISdHYscNSMy3cK/yKM7tzScVf3LKB+Rx lq3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P5J2xF9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x20-20020a656ab4000000b005aad7d77608si2917853pgu.138.2023.10.18.13.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 13:28:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P5J2xF9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id F1AE2824C4D3; Wed, 18 Oct 2023 13:28:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232022AbjJRU1z (ORCPT + 99 others); Wed, 18 Oct 2023 16:27:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231911AbjJRU1m (ORCPT ); Wed, 18 Oct 2023 16:27:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25C0FF7; Wed, 18 Oct 2023 13:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697660860; x=1729196860; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uBq0mn/KWsPThzvu8vYwD7SGaiak2SEULwdsVYDWNkE=; b=P5J2xF9mWbqUtNTW7KOh6Fuf+MiLyiMYzO4gb9k4biwP1lr4XcPrau4w JwMqSWz+cBJrO1uJOnDDXkNdPZZQxlyozEVNPM+4+Rf5rV05umb2G7WMk 3UThViwXnf6/IXrq8JMQXieVa2WwXDoS6gY1bTr4UwSOn0oqu00n75wL8 J9AETP1Q7hGBcedekD8Vw58R0IjKCDqBi4fojPR7qHs50WAeqaHVVuiRm GuMo8dVjQ6d1O2n4RcJiTmI9DdjdMHhnZhkApS6quJppZl0mD4i6dDXV9 aJs/YJo/5L23sh99u1p9nesJlajBaVq6KC8a6XTMv7UiWIaNymCQs6/if A==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="366352995" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="366352995" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 13:27:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="4691357" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa001.fm.intel.com with ESMTP; 18 Oct 2023 13:27:35 -0700 Received: from pkitszel-desk.intel.com (unknown [10.255.194.180]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 81E7E33E92; Wed, 18 Oct 2023 21:27:24 +0100 (IST) From: Przemek Kitszel To: Jiri Pirko , netdev@vger.kernel.org, "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shannon Nelson , Michael Chan , Cai Huoqing , George Cherian , Danielle Ratson , Moshe Shemesh , Saeed Mahameed , Ariel Elior , Manish Chopra , Igor Russkikh , Coiby Xu , Simon Horman Cc: Brett Creeley , Sunil Goutham , Linu Cherian , Geetha sowjanya , Jerin Jacob , hariprasad , Subbaraya Sundeep , Ido Schimmel , Petr Machata , Eran Ben Elisha , Aya Levin , Leon Romanovsky , linux-kernel@vger.kernel.org, Benjamin Poirier , Przemek Kitszel , Jesse Brandeburg , Jiri Pirko Subject: [PATCH net-next v3 03/11] pds_core: devlink health: use retained error fmsg API Date: Wed, 18 Oct 2023 22:26:39 +0200 Message-Id: <20231018202647.44769-4-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231018202647.44769-1-przemyslaw.kitszel@intel.com> References: <20231018202647.44769-1-przemyslaw.kitszel@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 18 Oct 2023 13:28:13 -0700 (PDT) Drop unneeded error checking. devlink_fmsg_*() family of functions is now retaining errors, so there is no need to check for them after each call. Reviewed-by: Jesse Brandeburg Reviewed-by: Jiri Pirko Reviewed-by: Shannon Nelson Signed-off-by: Przemek Kitszel --- add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-57 (-57) --- drivers/net/ethernet/amd/pds_core/devlink.c | 29 ++++++--------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/devlink.c b/drivers/net/ethernet/amd/pds_core/devlink.c index d9607033bbf2..8b2b9e0d59f3 100644 --- a/drivers/net/ethernet/amd/pds_core/devlink.c +++ b/drivers/net/ethernet/amd/pds_core/devlink.c @@ -154,33 +154,20 @@ int pdsc_fw_reporter_diagnose(struct devlink_health_reporter *reporter, struct netlink_ext_ack *extack) { struct pdsc *pdsc = devlink_health_reporter_priv(reporter); - int err; mutex_lock(&pdsc->config_lock); - if (test_bit(PDSC_S_FW_DEAD, &pdsc->state)) - err = devlink_fmsg_string_pair_put(fmsg, "Status", "dead"); + devlink_fmsg_string_pair_put(fmsg, "Status", "dead"); else if (!pdsc_is_fw_good(pdsc)) - err = devlink_fmsg_string_pair_put(fmsg, "Status", "unhealthy"); + devlink_fmsg_string_pair_put(fmsg, "Status", "unhealthy"); else - err = devlink_fmsg_string_pair_put(fmsg, "Status", "healthy"); - + devlink_fmsg_string_pair_put(fmsg, "Status", "healthy"); mutex_unlock(&pdsc->config_lock); - if (err) - return err; - - err = devlink_fmsg_u32_pair_put(fmsg, "State", - pdsc->fw_status & - ~PDS_CORE_FW_STS_F_GENERATION); - if (err) - return err; - - err = devlink_fmsg_u32_pair_put(fmsg, "Generation", - pdsc->fw_generation >> 4); - if (err) - return err; + devlink_fmsg_u32_pair_put(fmsg, "State", + pdsc->fw_status & ~PDS_CORE_FW_STS_F_GENERATION); + devlink_fmsg_u32_pair_put(fmsg, "Generation", pdsc->fw_generation >> 4); + devlink_fmsg_u32_pair_put(fmsg, "Recoveries", pdsc->fw_recoveries); - return devlink_fmsg_u32_pair_put(fmsg, "Recoveries", - pdsc->fw_recoveries); + return 0; } -- 2.38.1