Commit 3465915e authored by Przemek Kitszel's avatar Przemek Kitszel Committed by David S. Miller

staging: qlge: 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 avatarJiri Pirko <jiri@nvidia.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 18256cb2
...@@ -2,51 +2,29 @@ ...@@ -2,51 +2,29 @@
#include "qlge.h" #include "qlge.h"
#include "qlge_devlink.h" #include "qlge_devlink.h"
static int qlge_fill_seg_(struct devlink_fmsg *fmsg, static void qlge_fill_seg_(struct devlink_fmsg *fmsg,
struct mpi_coredump_segment_header *seg_header, struct mpi_coredump_segment_header *seg_header,
u32 *reg_data) u32 *reg_data)
{ {
int regs_num = (seg_header->seg_size int regs_num = (seg_header->seg_size
- sizeof(struct mpi_coredump_segment_header)) / sizeof(u32); - sizeof(struct mpi_coredump_segment_header)) / sizeof(u32);
int err;
int i; int i;
err = devlink_fmsg_pair_nest_start(fmsg, seg_header->description); devlink_fmsg_pair_nest_start(fmsg, seg_header->description);
if (err) devlink_fmsg_obj_nest_start(fmsg);
return err; devlink_fmsg_u32_pair_put(fmsg, "segment", seg_header->seg_num);
err = devlink_fmsg_obj_nest_start(fmsg); devlink_fmsg_arr_pair_nest_start(fmsg, "values");
if (err)
return err;
err = devlink_fmsg_u32_pair_put(fmsg, "segment", seg_header->seg_num);
if (err)
return err;
err = devlink_fmsg_arr_pair_nest_start(fmsg, "values");
if (err)
return err;
for (i = 0; i < regs_num; i++) { for (i = 0; i < regs_num; i++) {
err = devlink_fmsg_u32_put(fmsg, *reg_data); devlink_fmsg_u32_put(fmsg, *reg_data);
if (err)
return err;
reg_data++; reg_data++;
} }
err = devlink_fmsg_obj_nest_end(fmsg); devlink_fmsg_obj_nest_end(fmsg);
if (err) devlink_fmsg_arr_pair_nest_end(fmsg);
return err; devlink_fmsg_pair_nest_end(fmsg);
err = devlink_fmsg_arr_pair_nest_end(fmsg);
if (err)
return err;
err = devlink_fmsg_pair_nest_end(fmsg);
return err;
} }
#define FILL_SEG(seg_hdr, seg_regs) \ #define FILL_SEG(seg_hdr, seg_regs) \
do { \ qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs)
err = qlge_fill_seg_(fmsg, &dump->seg_hdr, dump->seg_regs); \
if (err) { \
kvfree(dump); \
return err; \
} \
} while (0)
static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, static int qlge_reporter_coredump(struct devlink_health_reporter *reporter,
struct devlink_fmsg *fmsg, void *priv_ctx, struct devlink_fmsg *fmsg, void *priv_ctx,
...@@ -114,14 +92,8 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, ...@@ -114,14 +92,8 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter,
FILL_SEG(xfi_hss_tx_hdr, serdes_xfi_hss_tx); FILL_SEG(xfi_hss_tx_hdr, serdes_xfi_hss_tx);
FILL_SEG(xfi_hss_rx_hdr, serdes_xfi_hss_rx); FILL_SEG(xfi_hss_rx_hdr, serdes_xfi_hss_rx);
FILL_SEG(xfi_hss_pll_hdr, serdes_xfi_hss_pll); FILL_SEG(xfi_hss_pll_hdr, serdes_xfi_hss_pll);
qlge_fill_seg_(fmsg, &dump->misc_nic_seg_hdr,
err = qlge_fill_seg_(fmsg, &dump->misc_nic_seg_hdr,
(u32 *)&dump->misc_nic_info); (u32 *)&dump->misc_nic_info);
if (err) {
kvfree(dump);
return err;
}
FILL_SEG(intr_states_seg_hdr, intr_states); FILL_SEG(intr_states_seg_hdr, intr_states);
FILL_SEG(cam_entries_seg_hdr, cam_entries); FILL_SEG(cam_entries_seg_hdr, cam_entries);
FILL_SEG(nic_routing_words_seg_hdr, nic_routing_words); FILL_SEG(nic_routing_words_seg_hdr, nic_routing_words);
...@@ -140,7 +112,7 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter, ...@@ -140,7 +112,7 @@ static int qlge_reporter_coredump(struct devlink_health_reporter *reporter,
FILL_SEG(sem_regs_seg_hdr, sem_regs); FILL_SEG(sem_regs_seg_hdr, sem_regs);
kvfree(dump); kvfree(dump);
return err; return 0;
} }
static const struct devlink_health_reporter_ops qlge_reporter_ops = { static const struct devlink_health_reporter_ops qlge_reporter_ops = {
......
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