libmultipath: remove unused code
authorBenjamin Marzinski <bmarzins@redhat.com>
Tue, 9 Oct 2018 23:03:06 +0000 (18:03 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 10 Oct 2018 06:09:34 +0000 (08:09 +0200)
since vector_foreach_slot() already checks if the entry is NULL, there's
no point in checking it in the loop, since it can't be NULL there. Found
by coverity.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
libmultipath/print.c

index 9da6a77..7b610b9 100644 (file)
@@ -275,8 +275,6 @@ snprint_multipath_vpr (char * buff, size_t len, const struct multipath * mpp)
        int i, j;
 
        vector_foreach_slot(mpp->pg, pgp, i) {
-               if (!pgp)
-                       continue;
                vector_foreach_slot(pgp->paths, pp, j) {
                        if (strlen(pp->vendor_id) && strlen(pp->product_id))
                                return snprintf(buff, len, "%s,%s",
@@ -295,8 +293,6 @@ snprint_multipath_vend (char * buff, size_t len, const struct multipath * mpp)
        int i, j;
 
        vector_foreach_slot(mpp->pg, pgp, i) {
-               if (!pgp)
-                       continue;
                vector_foreach_slot(pgp->paths, pp, j) {
                        if (strlen(pp->vendor_id))
                                return snprintf(buff, len, "%s", pp->vendor_id);
@@ -313,8 +309,6 @@ snprint_multipath_prod (char * buff, size_t len, const struct multipath * mpp)
        int i, j;
 
        vector_foreach_slot(mpp->pg, pgp, i) {
-               if (!pgp)
-                       continue;
                vector_foreach_slot(pgp->paths, pp, j) {
                        if (strlen(pp->product_id))
                                return snprintf(buff, len, "%s", pp->product_id);
@@ -331,8 +325,6 @@ snprint_multipath_rev (char * buff, size_t len, const struct multipath * mpp)
        int i, j;
 
        vector_foreach_slot(mpp->pg, pgp, i) {
-               if (!pgp)
-                       continue;
                vector_foreach_slot(pgp->paths, pp, j) {
                        if (strlen(pp->rev))
                                return snprintf(buff, len, "%s", pp->rev);