]> err.no Git - linux-2.6/commitdiff
[PATCH] swsusp warning fix
authorAndrew Morton <akpm@osdl.org>
Mon, 10 Jul 2006 11:45:00 +0000 (04:45 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 10 Jul 2006 20:24:22 +0000 (13:24 -0700)
kernel/power/swap.c: In function 'swsusp_write':
kernel/power/swap.c:275: warning: 'start' may be used uninitialized in this function

gcc isn't smart enough, so help it.

Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/swap.c

index 044b8e0c102547fe909e1d25142dad3c311ad4f8..a57c661c7e8a4844ddb6c790f86ee675408f67a0 100644 (file)
@@ -263,7 +263,6 @@ int swsusp_write(void)
        struct swap_map_handle handle;
        struct snapshot_handle snapshot;
        struct swsusp_info *header;
-       unsigned long start;
        int error;
 
        if ((error = swsusp_swap_check())) {
@@ -281,16 +280,17 @@ int swsusp_write(void)
        }
        error = get_swap_writer(&handle);
        if (!error) {
-               start = handle.cur_swap;
+               unsigned long start = handle.cur_swap;
                error = swap_write_page(&handle, header);
-       }
-       if (!error)
-               error = save_image(&handle, &snapshot, header->pages - 1);
-       if (!error) {
-               flush_swap_writer(&handle);
-               printk("S");
-               error = mark_swapfiles(swp_entry(root_swap, start));
-               printk("|\n");
+               if (!error)
+                       error = save_image(&handle, &snapshot,
+                                       header->pages - 1);
+               if (!error) {
+                       flush_swap_writer(&handle);
+                       printk("S");
+                       error = mark_swapfiles(swp_entry(root_swap, start));
+                       printk("|\n");
+               }
        }
        if (error)
                free_all_swap_pages(root_swap, handle.bitmap);