Re: [PATCH net-next v2 03/11] pds_core: devlink health: use retained error fmsg API

From: Jiri Pirko
Date: Tue Oct 17 2023 - 07:07:05 EST


Tue, Oct 17, 2023 at 12:53:33PM CEST, przemyslaw.kitszel@xxxxxxxxx wrote:
>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@xxxxxxxxx>
>Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
>---
>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;

Could you please covert the function to return void? Please make sure
to do this in the rest of the patchset as well.

Thanks!

pw-bot: cr


> }
>--
>2.40.1
>