From b99a83e052ce10f97af0a574f077167fcc992e6c Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Tue, 7 Jul 2015 16:08:15 +0900
Subject: [PATCH 3/4] Remove unnecessary NULL-pointer checks

All the code paths leading to those checks dereference those pointers.
Spotted by Coverity.
---
 src/backend/access/heap/visibilitymap.c   | 3 +--
 src/backend/storage/freespace/freespace.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 7c38772..acd9fde 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -510,8 +510,7 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
 	 * invalidate their copy of smgr_vm_nblocks, and this one too at the next
 	 * command boundary.  But this ensures it isn't outright wrong until then.
 	 */
-	if (rel->rd_smgr)
-		rel->rd_smgr->smgr_vm_nblocks = newnblocks;
+	rel->rd_smgr->smgr_vm_nblocks = newnblocks;
 }
 
 /*
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index fddb47c..c948cb6 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -308,8 +308,7 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
 	 * at the next command boundary.  But this ensures it isn't outright wrong
 	 * until then.
 	 */
-	if (rel->rd_smgr)
-		rel->rd_smgr->smgr_fsm_nblocks = new_nfsmblocks;
+	rel->rd_smgr->smgr_fsm_nblocks = new_nfsmblocks;
 }
 
 /*
-- 
2.4.5

