[PATCH 2/9] md/dm-table: Reduce the scope for a variable in dm_table_verify_integrity()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 1 Oct 2016 07:10:43 +0200

Move the definition for the variable "template_disk" into an if branch
so that an extra initialisation can be avoided at the beginning
by this refactoring.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
 drivers/md/dm-table.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index f6b817c..73d38d0 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1391,14 +1391,13 @@ int dm_calculate_queue_limits(struct dm_table *table,
  */
 static void dm_table_verify_integrity(struct dm_table *t)
 {
-	struct gendisk *template_disk = NULL;
-
 	if (t->integrity_supported) {
 		/*
 		 * Verify that the original integrity profile
 		 * matches all the devices in this table.
 		 */
-		template_disk = dm_table_get_integrity_disk(t);
+		struct gendisk *template_disk = dm_table_get_integrity_disk(t);
+
 		if (template_disk &&
 		    blk_integrity_compare(dm_disk(t->md), template_disk) >= 0)
 			return;
-- 
2.10.0

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux