From: Zdenek Kabelac Date: Tue, 30 Nov 2010 22:28:06 +0000 (+0000) Subject: Remove check for lv is NULL X-Git-Tag: v2_02_91~1321 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=81e606ab2c5cfe251a8261b2303263a4263f9cef;p=lvm2.git Remove check for lv is NULL '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. --- diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index bc9f8a10d..a58b7c5d5 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -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, ¶ms); - 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; diff --git a/lib/activate/dev_manager.h b/lib/activate/dev_manager.h index 50059bb37..b0bb275a2 100644 --- a/lib/activate/dev_manager.h +++ b/lib/activate/dev_manager.h @@ -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);