f2fs: return a default value for non-void function
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Fri, 21 Dec 2012 02:47:05 +0000 (11:47 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Fri, 28 Dec 2012 02:24:09 +0000 (11:24 +0900)
This patch resolves a build warning reported by kbuild test robot.

"
fs/f2fs/segment.c: In function '__get_segment_type':
fs/f2fs/segment.c:806:1: warning: control reaches end of non-void
function [-Wreturn-type]
"

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/segment.c
fs/f2fs/super.c

index ca7b5ffb09d5795f4c88eeb8387ae94f3c1b326c..fe2cc0bdc1157680a731dc052847558c8306e6c9 100644 (file)
@@ -791,11 +791,10 @@ static int __get_segment_type(struct page *page, enum page_type p_type)
                return __get_segment_type_2(page, p_type);
        case 4:
                return __get_segment_type_4(page, p_type);
-       case 6:
-               return __get_segment_type_6(page, p_type);
-       default:
-               BUG();
        }
+       /* NR_CURSEG_TYPE(6) logs by default */
+       BUG_ON(sbi->active_logs != NR_CURSEG_TYPE);
+       return __get_segment_type_6(page, p_type);
 }
 
 static void do_write_page(struct f2fs_sb_info *sbi, struct page *page,
index 50240d28ca240491a6502a2b2115861ea485e387..cf0ffb8006543237eb09ae8ef94a1a6f29990546 100644 (file)
@@ -302,7 +302,7 @@ static int parse_options(struct f2fs_sb_info *sbi, char *options)
                case Opt_active_logs:
                        if (args->from && match_int(args, &arg))
                                return -EINVAL;
-                       if (arg != 2 && arg != 4 && arg != 6)
+                       if (arg != 2 && arg != 4 && arg != NR_CURSEG_TYPE)
                                return -EINVAL;
                        sbi->active_logs = arg;
                        break;