Skip to contentSkip to conversation

master - coverity: eliminate DEADCODE

PATCH Zdenek Kabelac 1 participant 1 message Mar 1, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=36d0dcef38ec3ce89f3c13be272efc69f981b207
Commit:        36d0dcef38ec3ce89f3c13be272efc69f981b207
Parent:        8173c2ff9af805a1f8eb79fb4bd223622f79ad0d
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Mar 1 13:58:15 2016 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Mar 1 14:02:43 2016 +0100

coverity: eliminate DEADCODE

Coverity notice this cannot be NULL: cur = &dms->regions[*cur_r] so avoid NULL checking and simplify form.

---
 libdm/libdm-stats.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
libdm/libdm-stats.c +2 -4
index 82d3fa5..1dce3eb 100644
@@ -957,15 +957,13 @@ bad:
 static void _stats_walk_next(const struct dm_stats *dms, int region,
 			     uint64_t *cur_r, uint64_t *cur_a)
 {
-	struct dm_stats_region *cur = NULL;
+	struct dm_stats_region *cur;
 	int present;
 
 	if (!dms || !dms->regions)
 		return;
 
-	if (!(cur = &dms->regions[*cur_r]))
-		return;
-
+	cur = dms->regions + *cur_r;
 	present = _stats_region_present(cur);
 
 	if (region && present)