Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4050429rdg; Wed, 18 Oct 2023 13:28:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYgUj2+NxU0FGEdgALh/k2UreybrOnvfOqqEDvQd9MLEQr//iV52aHnEb+4vi02yAlAsSr X-Received: by 2002:a05:6358:16c6:b0:145:6560:d86d with SMTP id r6-20020a05635816c600b001456560d86dmr67015rwl.32.1697660888790; Wed, 18 Oct 2023 13:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697660888; cv=none; d=google.com; s=arc-20160816; b=cihjaAcg6IplbRW0uzn7fQnSlS/mNF4OqOzrpbKZASCIP1ai1izQTNIKb5pI2I8TvW y3S78vZkIvH/IWNMvG2SDxmBSG4YZh8+2Lki3N2XXvtYxBqt8/3EDaoohKK70YR1yMZI hiQ5nB0HaFT6Irhfw6zw8Hk7z8ZrWXuLAgbNu4mEI870wY2uZ4qw+s4SVuHMOMXDI/dE uqsjcEHfEI1ubxqeeG08CI2Bzto3yKwtm1qvXo3fPpndThJFxzLspARG7HWHod+5EBzZ rPHsInCmUm4HSKFuedvI+kqXEBloJREnVI83LRTx7AL5Z1xAnn0Jo5zaQmGSoHQTVCwh pvIw== 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=yFTxB7Xnj2DSyX7DQ6g7cWP1rx8z21Cz4RhYFxWxfGs=; fh=SyD2M+pRKkzHV5ojkm/537HJTx8M6EWb9+t8YPZNc44=; b=UuQRzydDFumy8NtfI18czjmGHd2OnUSrfAbbuc4fjzfXaLWsMECEn2xCsArMnMEVO8 yVxT+PzKpkcQN1CMXLpgBmgsH8Q4d/yb+H01WBsVAHj6NcnCKIEg4zaqkknU6xEpVUPp TlDcE/Ij5knw3kCk5gHke/6quwruOR7dJXYubH7aw52LxI9BOwEl8wjg038VYYD1XBHr krukL5eei2WWTMy1Zoj8H0hST6c4VftrYRqpatndMEmpjSQQEmEiB9LKSUCpgWdnVPIw wU/sUiQD+/V0VSt/EdEmRo3Q+3eJG+7FtV7t3/68WLTKHo1TFEF8ioujPEgiXL6iEauT k6ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jk1r9FiN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id d15-20020a65620f000000b00573f885c4edsi2769891pgv.368.2023.10.18.13.28.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 13:28:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jk1r9FiN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id E4E1181CC86F; Wed, 18 Oct 2023 13:28:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232277AbjJRU2D (ORCPT + 99 others); Wed, 18 Oct 2023 16:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbjJRU1w (ORCPT ); Wed, 18 Oct 2023 16:27:52 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76DC019D; Wed, 18 Oct 2023 13:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697660867; x=1729196867; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+xjFGFU3Ghawr8q7pdpDqNRlTkWqK1+SNcGCln6+RQc=; b=jk1r9FiNcZLDgkM7lAD8Voesa0Hots64vkVLDPQ9KdqlpJMgWLDiL4Qx WXdT5EZLqllVWqHn5duB5zLNFCi4iHCzKKJ1z3Cckw+AOBkGyYJOZpTIY YlnamxnbpJPU+115kYEoK/4RpIrEMCmN7d/dpbiHxy0ZJLZFB8GGtvTtI bBAQkk+NDusifIVid9NGUKPvHcgZF63Oc8ojBRuWqvEHRO/9fAcjJl014 sgPcjPp9ShZeJWTg2iYAWP4wF2juniH/e1jf/HJa9QJy+yPnEwOCQK1WK BP4ATFWfBokKHJn/TuVL1d+CZbm96TJw4o8ckdfnHB/0rqp7DXohKdFrD w==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="366353018" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="366353018" 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:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="4691405" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa001.fm.intel.com with ESMTP; 18 Oct 2023 13:27:42 -0700 Received: from pkitszel-desk.intel.com (unknown [10.255.194.180]) by irvmail002.ir.intel.com (Postfix) with ESMTP id D78ED332CA; Wed, 18 Oct 2023 21:27:31 +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 04/11] bnxt_en: devlink health: use retained error fmsg API Date: Wed, 18 Oct 2023 22:26:40 +0200 Message-Id: <20231018202647.44769-5-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 13:28:07 -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 Signed-off-by: Przemek Kitszel --- add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-125 (-125) --- .../net/ethernet/broadcom/bnxt/bnxt_devlink.c | 93 +++++++------------ 1 file changed, 32 insertions(+), 61 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index 8b3e7697390f..09254e8a62d0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -104,80 +104,58 @@ static int bnxt_fw_diagnose(struct devlink_health_reporter *reporter, struct bnxt *bp = devlink_health_reporter_priv(reporter); struct bnxt_fw_health *h = bp->fw_health; u32 fw_status, fw_resets; - int rc; - if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) - return devlink_fmsg_string_pair_put(fmsg, "Status", "recovering"); + if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) { + devlink_fmsg_string_pair_put(fmsg, "Status", "recovering"); + return 0; + } - if (!h->status_reliable) - return devlink_fmsg_string_pair_put(fmsg, "Status", "unknown"); + if (!h->status_reliable) { + devlink_fmsg_string_pair_put(fmsg, "Status", "unknown"); + return 0; + } mutex_lock(&h->lock); fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG); if (BNXT_FW_IS_BOOTING(fw_status)) { - rc = devlink_fmsg_string_pair_put(fmsg, "Status", "initializing"); - if (rc) - goto unlock; + devlink_fmsg_string_pair_put(fmsg, "Status", "initializing"); } else if (h->severity || fw_status != BNXT_FW_STATUS_HEALTHY) { if (!h->severity) { h->severity = SEVERITY_FATAL; h->remedy = REMEDY_POWER_CYCLE_DEVICE; h->diagnoses++; devlink_health_report(h->fw_reporter, "FW error diagnosed", h); } - rc = devlink_fmsg_string_pair_put(fmsg, "Status", "error"); - if (rc) - goto unlock; - rc = devlink_fmsg_u32_pair_put(fmsg, "Syndrome", fw_status); - if (rc) - goto unlock; + devlink_fmsg_string_pair_put(fmsg, "Status", "error"); + devlink_fmsg_u32_pair_put(fmsg, "Syndrome", fw_status); } else { - rc = devlink_fmsg_string_pair_put(fmsg, "Status", "healthy"); - if (rc) - goto unlock; + devlink_fmsg_string_pair_put(fmsg, "Status", "healthy"); } - rc = devlink_fmsg_string_pair_put(fmsg, "Severity", - bnxt_health_severity_str(h->severity)); - if (rc) - goto unlock; + devlink_fmsg_string_pair_put(fmsg, "Severity", + bnxt_health_severity_str(h->severity)); if (h->severity) { - rc = devlink_fmsg_string_pair_put(fmsg, "Remedy", - bnxt_health_remedy_str(h->remedy)); - if (rc) - goto unlock; - if (h->remedy == REMEDY_DEVLINK_RECOVER) { - rc = devlink_fmsg_string_pair_put(fmsg, "Impact", - "traffic+ntuple_cfg"); - if (rc) - goto unlock; - } + devlink_fmsg_string_pair_put(fmsg, "Remedy", + bnxt_health_remedy_str(h->remedy)); + if (h->remedy == REMEDY_DEVLINK_RECOVER) + devlink_fmsg_string_pair_put(fmsg, "Impact", + "traffic+ntuple_cfg"); } -unlock: mutex_unlock(&h->lock); - if (rc || !h->resets_reliable) - return rc; + if (!h->resets_reliable) + return 0; fw_resets = bnxt_fw_health_readl(bp, BNXT_FW_RESET_CNT_REG); - rc = devlink_fmsg_u32_pair_put(fmsg, "Resets", fw_resets); - if (rc) - return rc; - rc = devlink_fmsg_u32_pair_put(fmsg, "Arrests", h->arrests); - if (rc) - return rc; - rc = devlink_fmsg_u32_pair_put(fmsg, "Survivals", h->survivals); - if (rc) - return rc; - rc = devlink_fmsg_u32_pair_put(fmsg, "Discoveries", h->discoveries); - if (rc) - return rc; - rc = devlink_fmsg_u32_pair_put(fmsg, "Fatalities", h->fatalities); - if (rc) - return rc; - return devlink_fmsg_u32_pair_put(fmsg, "Diagnoses", h->diagnoses); + devlink_fmsg_u32_pair_put(fmsg, "Resets", fw_resets); + devlink_fmsg_u32_pair_put(fmsg, "Arrests", h->arrests); + devlink_fmsg_u32_pair_put(fmsg, "Survivals", h->survivals); + devlink_fmsg_u32_pair_put(fmsg, "Discoveries", h->discoveries); + devlink_fmsg_u32_pair_put(fmsg, "Fatalities", h->fatalities); + devlink_fmsg_u32_pair_put(fmsg, "Diagnoses", h->diagnoses); + return 0; } static int bnxt_fw_dump(struct devlink_health_reporter *reporter, @@ -203,19 +181,12 @@ static int bnxt_fw_dump(struct devlink_health_reporter *reporter, rc = bnxt_get_coredump(bp, BNXT_DUMP_LIVE, data, &dump_len); if (!rc) { - rc = devlink_fmsg_pair_nest_start(fmsg, "core"); - if (rc) - goto exit; - rc = devlink_fmsg_binary_pair_put(fmsg, "data", data, dump_len); - if (rc) - goto exit; - rc = devlink_fmsg_u32_pair_put(fmsg, "size", dump_len); - if (rc) - goto exit; - rc = devlink_fmsg_pair_nest_end(fmsg); + devlink_fmsg_pair_nest_start(fmsg, "core"); + devlink_fmsg_binary_pair_put(fmsg, "data", data, dump_len); + devlink_fmsg_u32_pair_put(fmsg, "size", dump_len); + devlink_fmsg_pair_nest_end(fmsg); } -exit: vfree(data); return rc; } -- 2.38.1