error-inject: Remove redundant has_nfit check
PATCH 1/1 error-inject: Remove redundant has_nfit check
ndctl_bus_has_error_injection already has the ndctl_bus_has_nfit check. Remove the redundant checks.
Signed-off-by Santosh Sivaraj <[email protected]>
--- ndctl/lib/inject.c | 73 +++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 40 deletions(-)
ndctl/lib/inject.c +33 -40
@@ -190,8 +190,6 @@ NDCTL_EXPORT int ndctl_namespace_inject_error2(struct ndctl_namespace *ndns,if (!ndctl_bus_has_error_injection (bus))return -EOPNOTSUPP ; -if (!ndctl_bus_has_nfit (bus)) -return -EOPNOTSUPP ;for (i =0 ; i < count; i++) { rc =ndctl_namespace_inject_one_error (ndns, block + i, flags);
@@ -268,8 +266,6 @@ NDCTL_EXPORT int ndctl_namespace_uninject_error2(struct ndctl_namespace *ndns,if (!ndctl_bus_has_error_injection (bus))return -EOPNOTSUPP ; -if (!ndctl_bus_has_nfit (bus)) -return -EOPNOTSUPP ;for (i =0 ; i < count; i++) { rc = ndctl_namespace_uninject_one_error(ndns, block + i,
@@ -450,46 +446,43 @@ NDCTL_EXPORT int ndctl_namespace_injection_status(struct ndctl_namespace *ndns)if (!ndctl_bus_has_error_injection (bus))return -EOPNOTSUPP ; -if (ndctl_bus_has_nfit (bus)) { - rc =ndctl_namespace_get_injection_bounds (ndns, &ns_offset, - &ns_size); -if (rc) -return rc; + rc =ndctl_namespace_get_injection_bounds (ndns, &ns_offset, + &ns_size); +if (rc) +return rc; - cmd =ndctl_bus_cmd_new_ars_cap (bus, ns_offset, ns_size); - rc =ndctl_cmd_submit (cmd); -if (rc <0 ) { -dbg (ctx,"Error submitting ars_cap: %d\n" , rc); - goto out; - } - buf_size =ndctl_cmd_ars_cap_get_size (cmd); -if (buf_size ==0 ) { -dbg (ctx,"Got an invalid max_ars_out from ars_cap\n" ); - rc = -EINVAL ; - goto out; - } -ndctl_cmd_unref (cmd); + cmd =ndctl_bus_cmd_new_ars_cap (bus, ns_offset, ns_size); + rc =ndctl_cmd_submit (cmd); +if (rc <0 ) { +dbg (ctx,"Error submitting ars_cap: %d\n" , rc); + goto out; + } + buf_size =ndctl_cmd_ars_cap_get_size (cmd); +if (buf_size ==0 ) { +dbg (ctx,"Got an invalid max_ars_out from ars_cap\n" ); + rc = -EINVAL ; + goto out; + } +ndctl_cmd_unref (cmd); - cmd =ndctl_bus_cmd_new_err_inj_stat (bus, buf_size); -if (!cmd) -return -ENOMEM ; + cmd =ndctl_bus_cmd_new_err_inj_stat (bus, buf_size); +if (!cmd) +return -ENOMEM ; - pkg = (struct nd_cmd_pkg *)&cmd->cmd_buf[0 ]; - err_inj_stat = - (struct nd_cmd_ars_err_inj_stat *)&pkg->nd_payload[0 ]; + pkg = (struct nd_cmd_pkg *)&cmd->cmd_buf[0 ]; + err_inj_stat = + (struct nd_cmd_ars_err_inj_stat *)&pkg->nd_payload[0 ]; - rc =ndctl_cmd_submit (cmd); -if (rc <0 ) { -dbg (ctx,"Error submitting command: %d\n" , rc); - goto out; - } - rc =injection_status_to_bb (ndns, err_inj_stat, - ns_offset, ns_size); -if (rc) { -dbg (ctx,"Error converting status to badblocks: %d\n" , - rc); - goto out; - } + rc =ndctl_cmd_submit (cmd); +if (rc <0 ) { +dbg (ctx,"Error submitting command: %d\n" , rc); + goto out; + } + rc =injection_status_to_bb (ndns, err_inj_stat, + ns_offset, ns_size); +if (rc) { +dbg (ctx,"Error converting status to badblocks: %d\n" , rc); + goto out; } out:
Signature · 4 lines
2.26.2 _______________________________________________ Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]