lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231018202647.44769-4-przemyslaw.kitszel@intel.com>
Date: Wed, 18 Oct 2023 22:26:39 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jiri Pirko <jiri@...nulli.us>,
	netdev@...r.kernel.org,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Shannon Nelson <shannon.nelson@....com>,
	Michael Chan <michael.chan@...adcom.com>,
	Cai Huoqing <cai.huoqing@...ux.dev>,
	George Cherian <george.cherian@...vell.com>,
	Danielle Ratson <danieller@...dia.com>,
	Moshe Shemesh <moshe@...dia.com>,
	Saeed Mahameed <saeedm@...dia.com>,
	Ariel Elior <aelior@...vell.com>,
	Manish Chopra <manishc@...vell.com>,
	Igor Russkikh <irusskikh@...vell.com>,
	Coiby Xu <coiby.xu@...il.com>,
	Simon Horman <horms@...nel.org>
Cc: Brett Creeley <brett.creeley@....com>,
	Sunil Goutham <sgoutham@...vell.com>,
	Linu Cherian <lcherian@...vell.com>,
	Geetha sowjanya <gakula@...vell.com>,
	Jerin Jacob <jerinj@...vell.com>,
	hariprasad <hkelam@...vell.com>,
	Subbaraya Sundeep <sbhatta@...vell.com>,
	Ido Schimmel <idosch@...dia.com>,
	Petr Machata <petrm@...dia.com>,
	Eran Ben Elisha <eranbe@...dia.com>,
	Aya Levin <ayal@...lanox.com>,
	Leon Romanovsky <leon@...nel.org>,
	linux-kernel@...r.kernel.org,
	Benjamin Poirier <bpoirier@...e.com>,
	Przemek Kitszel <przemyslaw.kitszel@...el.com>,
	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Jiri Pirko <jiri@...dia.com>
Subject: [PATCH net-next v3 03/11] pds_core: devlink health: use retained error fmsg API

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 <jesse.brandeburg@...el.com>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Reviewed-by: Shannon Nelson <shannon.nelson@....com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
---
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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ