Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3070906rdg; Tue, 17 Oct 2023 03:54:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKnE4WKiRIUHv6RNT4fum4EGkSWvB1C37jrN98NXCDW0jXxIVBqmzKLLhOhOXZA1HHccaj X-Received: by 2002:a05:6808:10ce:b0:3a7:4876:6044 with SMTP id s14-20020a05680810ce00b003a748766044mr2573940ois.52.1697540084689; Tue, 17 Oct 2023 03:54:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697540084; cv=none; d=google.com; s=arc-20160816; b=f2ytR02gzM5oaA+lzH2/Gf3dRN06smgzBE5sSre2BF1t5PQN02hWvshKeos7r3Fi0q dekcyHwJIOP37FN13fEt+/K+EfNf/WjJOKq0KiuRDYLgJhHwAXYYdHOyVmeDspfRXJQA XeVBHmKXTtqes7EuyTbLuHO/MvzDkY34Jt8P5/5gMcNF+/6OnHG/KXmQTY1XN0ACCBJ7 Mwc/4x2ztbft5ciTsU3jpMQ1Zd4tNowyMCXPuq9H7cSorXsZKe+rb6mb8orGi+5gmihk wThPgrN9Nzk6y8Hknn1khN71wWMGEkrqpf1TTiqoYGB0dGnlZ8NY/I4AJjwjDL4jFEfS wq9A== 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=8dHuRdPiabd0qkJYS/Xl8oAxO8mNUwHvWa+STtKpP4o=; fh=LUcGN4RxgTEqzo8Xyd/YCx2ro8bwpTjzYbakoyxycXY=; b=sYXD2/oJWUl8Kj/duVkqIWGmT67OO2iBJON0i6MFR+pZWkunjbA180Nm2NBY/h4JGh H7RqlTzUmbN2PVDEV4r8zbk74Q4+VoEuFKPjCAOtoiAnF5nne87WlrsSs1jm4GExZJQr iP1QoWdK8WWXY9qZtKTiObcMZDm8U5hWi/SV8OzUpYhU9RKb8SB2BpK6RK/jgJqa6TX9 NDTLvOnGNYQj6Xl6OVps+2zAIXmee3dn8ImeU30pX/mGEC2twp5DZAtybBzCYNmaa9V2 O6O/1H1OJ5MtEMGeKwKISabXxrEkT4yduZCmrFSW39Mo8UBplaFWRr5XS9c2BmPUIThP B0EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Lf0ntuAs; 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 v24-20020a63f218000000b005b422bf48a4si732331pgh.89.2023.10.17.03.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 03:54:44 -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=Lf0ntuAs; 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 E5449802F560; Tue, 17 Oct 2023 03:54:39 -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 S1343758AbjJQKy3 (ORCPT + 99 others); Tue, 17 Oct 2023 06:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234877AbjJQKy0 (ORCPT ); Tue, 17 Oct 2023 06:54:26 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05615B0; Tue, 17 Oct 2023 03:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697540065; x=1729076065; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JiFO0Fqm2ckPnb/YIHKHWKu6u2FkwmpZq9Xq6Dn3S5A=; b=Lf0ntuAs7ECGbWBUhUpOnCS16/9HwOlRpaNCOGYXm0hJbXiCw16sA7Wc C6LaZD0LpviGoqhbL5g9nzMhUbsLeVQ1jEdhYrp/bQ38Uv7Bz5twahP+O xBq7HY3Q8hbKTDW62AgNXM1j3x0NAsdoOpOVmxsLkNf4AQlljoBzFSsE4 iSb0+VeRStcBWMm7BI3CUvYDInTvte4ku8e8p0r53Q76upW2eNGwaFGJk 1p8EmS1t9H7Horxy0HeckTPPbSy9wKFmWfVJPHONMjio4UYTScw1yPBSz DElTvQ3x1o0bj3vNS6wUb2YvGG9B97V9yEp6B+rgXhiw+cjbaRloc9vCL w==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="366012640" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="366012640" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2023 03:54:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="785445297" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="785445297" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by orsmga008.jf.intel.com with ESMTP; 17 Oct 2023 03:54:17 -0700 Received: from pelor.igk.intel.com (pelor.igk.intel.com [10.123.220.13]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 8B493312D4; Tue, 17 Oct 2023 11:54:14 +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 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, Przemek Kitszel , Jesse Brandeburg Subject: [PATCH net-next v2 03/11] pds_core: devlink health: use retained error fmsg API Date: Tue, 17 Oct 2023 12:53:33 +0200 Message-Id: <20231017105341.415466-4-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017105341.415466-1-przemyslaw.kitszel@intel.com> References: <20231017105341.415466-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]); Tue, 17 Oct 2023 03:54:40 -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 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.40.1