]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
pds_core: devlink health: use retained error fmsg API
authorPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Wed, 18 Oct 2023 20:26:39 +0000 (22:26 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Oct 2023 10:34:49 +0000 (11:34 +0100)
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@intel.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/pds_core/devlink.c

index d9607033bbf21f9cff3f3baf1bff08162a07f715..8b2b9e0d59f31b1b915a7eed1475fdaf1dcb9147 100644 (file)
@@ -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;
 }