]> sourceware.org Git - lvm2.git/commitdiff
Remove check for lv is NULL
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 30 Nov 2010 22:28:06 +0000 (22:28 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 30 Nov 2010 22:28:06 +0000 (22:28 +0000)
'lv' is deferenced in the begining of the function so any check
later is not helpful.

Parameters for dev_manager_transien() are marked as nonnull.

lib/activate/dev_manager.c
lib/activate/dev_manager.h

index bc9f8a10dbe3278247f1a9ffdbb0ceb79ea868ee..a58b7c5d5efef950e5ffab59cde7b69d51faac57 100644 (file)
@@ -601,14 +601,13 @@ int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv)
        do {
                next = dm_get_next_target(dmt, next, &start, &length, &type,
                                          &params);
-               if (lv) {
-                       if (!(segh = dm_list_next(&lv->segments, segh))) {
-                               log_error("Number of segments in active LV %s "
-                                         "does not match metadata", lv->name);
-                               goto out;
-                       }
-                       seg = dm_list_item(segh, struct lv_segment);
+
+               if (!(segh = dm_list_next(&lv->segments, segh))) {
+                   log_error("Number of segments in active LV %s "
+                             "does not match metadata", lv->name);
+                   goto out;
                }
+               seg = dm_list_item(segh, struct lv_segment);
 
                if (!type || !params)
                        continue;
@@ -619,7 +618,7 @@ int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv)
 
        } while (next);
 
-       if (lv && (segh = dm_list_next(&lv->segments, segh))) {
+       if ((segh = dm_list_next(&lv->segments, segh))) {
                log_error("Number of segments in active LV %s does not "
                          "match metadata", lv->name);
                goto out;
index 50059bb3766ced60ca133176ee1d52cace1b7c39..b0bb275a28d717405031ce70c188199a713ff02c 100644 (file)
@@ -56,7 +56,7 @@ int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv, unsi
 int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv,
                        unsigned origin_only, int *flush_required);
 int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv);
-int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv);
+int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv) __attribute__((nonnull(1, 2)));
 
 int dev_manager_mknodes(const struct logical_volume *lv);
 
This page took 0.039122 seconds and 5 git commands to generate.