Commit 47957bb3 authored by Przemek Kitszel's avatar Przemek Kitszel Committed by David S. Miller

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: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Reviewed-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Signed-off-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 20f9b9d3
......@@ -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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment