diff mbox

[ndctl,1/3] libndctl: refactor returns in ndctl_bus_get_scrub_count

Message ID 20171106231610.8271-1-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L Nov. 6, 2017, 11:16 p.m. UTC
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.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
 ndctl/lib/libndctl.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox

Patch

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;