[parted-devel] [PATCH 01/24] libparted: Fix a GCC warning -Wunused-but-set-variable

Brian C. Lane bcl at redhat.com
Sat Nov 14 00:11:44 GMT 2020


From: Shin'ichiro Kawasaki <kawasaki at juno.dti.ne.jp>

GCC warns that a variable 'prealloc' defined for _generic_affs_probe() in
fs/amiga/affs.c is set but its value is never used.

  CC       amiga/affs.lo
amiga/affs.c: In function '_generic_affs_probe':
amiga/affs.c:54:35: warning: variable 'prealloc' set but not used [-Wunused-but-set-variable]
   54 |  int blocksize = 1, reserved = 2, prealloc = 0;
      |                                   ^~~~~~~~
Remove the variable for simplicity and to avoid the warning.

Signed-off-by: Shin'ichiro Kawasaki <kawasaki at juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl at redhat.com>
---
 libparted/fs/amiga/affs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libparted/fs/amiga/affs.c b/libparted/fs/amiga/affs.c
index 1fde17c..e7c2e47 100644
--- a/libparted/fs/amiga/affs.c
+++ b/libparted/fs/amiga/affs.c
@@ -52,20 +52,19 @@ _generic_affs_probe (PedGeometry* geom, uint32_t kind)
 	uint32_t *block;
 	PedSector root, len, pos;
 	struct PartitionBlock * part;
-	int blocksize = 1, reserved = 2, prealloc = 0;
+	int blocksize = 1, reserved = 2;
 
 	PED_ASSERT (geom != NULL);
 	PED_ASSERT (geom->dev != NULL);
 	if (geom->dev->sector_size != 512)
 		return NULL;
-	/* Finds the blocksize, prealloc and reserved values of the partition block */
+	/* Finds the blocksize and reserved values of the partition block */
 	if (!(part = ped_malloc (PED_SECTOR_SIZE_DEFAULT*blocksize))) {
 		ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
 			_("%s : Failed to allocate partition block\n"), __func__);
 		goto error_part;
 	}
 	if (amiga_find_part(geom, part) != NULL) {
-		prealloc = PED_BE32_TO_CPU (part->de_PreAlloc);
 		reserved = PED_BE32_TO_CPU (part->de_Reserved);
 		reserved = reserved == 0 ? 1 : reserved;
 		blocksize = PED_BE32_TO_CPU (part->de_SizeBlock)
-- 
2.26.2




More information about the parted-devel mailing list