Skip to contentSkip to conversation

udf: fix sparse warnings

PATCH In review Hannes Eder 3 participants 4 messages Nov 27, 2008 – Dec 1, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udf: fix sparse warnings

Fix this sparse warnings:

fs/udf/balloc.c:843:3: warning: returning void-valued expression fs/udf/balloc.c:847:3: warning: returning void-valued expression fs/udf/balloc.c:851:3: warning: returning void-valued expression fs/udf/balloc.c:855:3: warning: returning void-valued expression

---
 fs/udf/balloc.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
fs/udf/balloc.c +12 -12
index c0e87db..7328291 100644
@@ -840,21 +840,21 @@ void udf_free_blocks(struct super_block *sb, struct inode *inode,
 	struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
 
 	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
-		return udf_bitmap_free_blocks(sb, inode,
-					      map->s_uspace.s_bitmap,
-					      bloc, offset, count);
+		udf_bitmap_free_blocks(sb, inode, map->s_uspace.s_bitmap,
+				       bloc, offset, count);
+		return;
 	} else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
-		return udf_table_free_blocks(sb, inode,
-					     map->s_uspace.s_table,
-					     bloc, offset, count);
+		udf_table_free_blocks(sb, inode, map->s_uspace.s_table,
+				      bloc, offset, count);
+		return;
 	} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
-		return udf_bitmap_free_blocks(sb, inode,
-					      map->s_fspace.s_bitmap,
-					      bloc, offset, count);
+		udf_bitmap_free_blocks(sb, inode, map->s_fspace.s_bitmap,
+				       bloc, offset, count);
+		return;
 	} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
-		return udf_table_free_blocks(sb, inode,
-					     map->s_fspace.s_table,
-					     bloc, offset, count);
+		udf_table_free_blocks(sb, inode, map->s_fspace.s_table,
+				      bloc, offset, count);
+		return;
 	} else {
 		return;
 	}
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 8 lines · Hannes Eder

Fix this sparse warnings:

fs/udf/balloc.c:843:3: warning: returning void-valued expression fs/udf/balloc.c:847:3: warning: returning void-valued expression fs/udf/balloc.c:851:3: warning: returning void-valued expression fs/udf/balloc.c:855:3: warning: returning void-valued expression

Thanks for the patch. But when we are at it, I'd rather go for the
following change:

From f3facf9a4a60bba9f1fa0c779fc441c6aff90eb4 Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Mon, 1 Dec 2008 13:06:10 +0100
Subject: [PATCH] udf: fix sparse warnings:

Fix sparse warnings:

fs/udf/balloc.c:843:3: warning: returning void-valued expression fs/udf/balloc.c:847:3: warning: returning void-valued expression fs/udf/balloc.c:851:3: warning: returning void-valued expression fs/udf/balloc.c:855:3: warning: returning void-valued expression

---
 fs/udf/balloc.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
fs/udf/balloc.c +9 -14
index c0e87db..cde1a0d 100644
@@ -840,24 +840,19 @@ void udf_free_blocks(struct super_block *sb, struct inode *inode,
 	struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
 
 	if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
-		return udf_bitmap_free_blocks(sb, inode,
-					      map->s_uspace.s_bitmap,
-					      bloc, offset, count);
+		udf_bitmap_free_blocks(sb, inode, map->s_uspace.s_bitmap,
+				       bloc, offset, count);
 	} else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
-		return udf_table_free_blocks(sb, inode,
-					     map->s_uspace.s_table,
-					     bloc, offset, count);
+		udf_table_free_blocks(sb, inode, map->s_uspace.s_table,
+				      bloc, offset, count);
 	} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
-		return udf_bitmap_free_blocks(sb, inode,
-					      map->s_fspace.s_bitmap,
-					      bloc, offset, count);
+		udf_bitmap_free_blocks(sb, inode, map->s_fspace.s_bitmap,
+				       bloc, offset, count);
 	} else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
-		return udf_table_free_blocks(sb, inode,
-					     map->s_fspace.s_table,
-					     bloc, offset, count);
-	} else {
-		return;
+		udf_table_free_blocks(sb, inode, map->s_fspace.s_table,
+				      bloc, offset, count);
 	}
+	return;
 }
 
 inline int udf_prealloc_blocks(struct super_block *sb,
Signature · 1 line
1.6.0.4
#2 lore raw
Quoted 69 lines · Jan Kara
Quoted 8 lines · Hannes Eder

Fix this sparse warnings:

fs/udf/balloc.c:843:3: warning: returning void-valued expression fs/udf/balloc.c:847:3: warning: returning void-valued expression fs/udf/balloc.c:851:3: warning: returning void-valued expression fs/udf/balloc.c:855:3: warning: returning void-valued expression

Thanks for the patch. But when we are at it, I'd rather go for the
following change:

From f3facf9a4a60bba9f1fa0c779fc441c6aff90eb4 Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Mon, 1 Dec 2008 13:06:10 +0100
Subject: [PATCH] udf: fix sparse warnings:

Fix sparse warnings:

fs/udf/balloc.c:843:3: warning: returning void-valued expression fs/udf/balloc.c:847:3: warning: returning void-valued expression fs/udf/balloc.c:851:3: warning: returning void-valued expression fs/udf/balloc.c:855:3: warning: returning void-valued expression

---
 fs/udf/balloc.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)
fs/udf/balloc.c +9 -15
index c0e87db..cde1a0d 100644
@@ -840,24 +840,19 @@ void udf_free_blocks(struct super_block *sb, struct inode *inode,
       struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
 
       if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
-               return udf_bitmap_free_blocks(sb, inode,
-                                             map->s_uspace.s_bitmap,
-                                             bloc, offset, count);
+               udf_bitmap_free_blocks(sb, inode, map->s_uspace.s_bitmap,
+                                      bloc, offset, count);
       } else if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
-               return udf_table_free_blocks(sb, inode,
-                                            map->s_uspace.s_table,
-                                            bloc, offset, count);
+               udf_table_free_blocks(sb, inode, map->s_uspace.s_table,
+                                     bloc, offset, count);
       } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) {
-               return udf_bitmap_free_blocks(sb, inode,
-                                             map->s_fspace.s_bitmap,
-                                             bloc, offset, count);
+               udf_bitmap_free_blocks(sb, inode, map->s_fspace.s_bitmap,
+                                      bloc, offset, count);
       } else if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) {
-               return udf_table_free_blocks(sb, inode,
-                                            map->s_fspace.s_table,
-                                            bloc, offset, count);
-       } else {
-               return;
+               udf_table_free_blocks(sb, inode, map->s_fspace.s_table,
+                                     bloc, offset, count);
       }
+       return;
 }
 
 inline int udf_prealloc_blocks(struct super_block *sb,
--
Quoted 1 line

1.6.0.4

I prefer your version. I though about it as well, but then tried to do kind of 'minimal change' patch, and leave the control flow as is.

Hannes

#3 lore raw
In reply to Jan Kara
Quoted 4 lines · Jan Kara

From f3facf9a4a60bba9f1fa0c779fc441c6aff90eb4 Mon Sep 17 00:00:00 2001
From: Jan Kara <[email protected]>
Date: Mon, 1 Dec 2008 13:06:10 +0100
Subject: [PATCH] udf: fix sparse warnings:

[...]

fs/udf/balloc.c void udf_free_blocks(struct super_block *sb, struct inode *inode, · line 856

Quoted 7 lines
fs/udf/balloc.c +3 -2
-       } else {
-               return;
+               udf_table_free_blocks(sb, inode, map->s_fspace.s_table,
+                                     bloc, offset, count);
       }
+       return;
 }

Harmless, but in this case you don't need the return at all.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com