Static analysis warns about logically dead/unreachable code since all options for 'rc' are accounted for. Make this section a bit more succinct, while fixing both this warning as well as ensuring gcc doesn't warn about reaching the end of a non-void function.
Cc: Dan Williams <dan.j.willi...@intel.com> Signed-off-by: Vishal Verma <vishal.l.ve...@intel.com> --- ndctl/lib/libndctl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 4434846..e78a32c 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -1086,13 +1086,7 @@ NDCTL_EXPORT unsigned int ndctl_bus_get_scrub_count(struct ndctl_bus *bus) return UINT_MAX; rc = sscanf(buf, "%u%c", &scrub_count, &in_progress); - if (rc < 0) - return UINT_MAX; - if (rc == 0) { - /* unable to read scrub count */ - return UINT_MAX; - } - if (rc >= 1) + if (rc > 0) return scrub_count; return UINT_MAX; -- 2.9.5 _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm