yaffs Clean up conditional bracing
authorCharles Manning <cdhmanning@gmail.com>
Sun, 7 Nov 2010 22:09:07 +0000 (11:09 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Sun, 7 Nov 2010 22:09:07 +0000 (11:09 +1300)
If a conditional has braces then all paths have braces even if they only
have one statement.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_allocator.c
yaffs_checkptrw.c
yaffs_guts.c
yaffs_mtdif2_multi.c
yaffs_mtdif2_single.c
yaffs_nameval.c
yaffs_vfs_multi.c
yaffs_vfs_single.c
yaffs_yaffs1.c
yaffs_yaffs2.c

index 03ede86..b9fe31e 100644 (file)
@@ -123,8 +123,9 @@ static void yaffs_init_raw_tnodes(struct yaffs_dev *dev)
                allocator->free_tnodes = NULL;
                allocator->n_free_tnodes = 0;
                allocator->n_tnodes_created = 0;
-       } else
+       } else {
                YBUG();
+       }
 }
 
 static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes)
@@ -243,8 +244,9 @@ static void yaffs_init_raw_objs(struct yaffs_dev *dev)
                allocator->allocated_obj_list = NULL;
                allocator->free_objs = NULL;
                allocator->n_free_objects = 0;
-       } else
+       } else {
                YBUG();
+       }
 }
 
 static void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
@@ -371,8 +373,9 @@ void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
 
                YFREE(dev->allocator);
                dev->allocator = NULL;
-       } else
+       } else {
                YBUG();
+       }
 }
 
 void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
@@ -386,8 +389,9 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
                        yaffs_init_raw_tnodes(dev);
                        yaffs_init_raw_objs(dev);
                }
-       } else
+       } else {
                YBUG();
+       }
 }
 
 #endif
index 2cb144c..02b8ce6 100644 (file)
@@ -403,8 +403,9 @@ int yaffs_checkpt_close(struct yaffs_dev *dev)
                YFREE(dev->checkpt_buffer);
                dev->checkpt_buffer = NULL;
                return 1;
-       } else
+       } else {
                return 0;
+        }
 }
 
 int yaffs2_checkpt_invalidate_stream(struct yaffs_dev *dev)
index a9fc46c..53c2ff6 100644 (file)
@@ -1708,8 +1708,9 @@ static int yaffs_init_blocks(struct yaffs_dev *dev)
                dev->block_info =
                    YMALLOC_ALT(n_blocks * sizeof(struct yaffs_block_info));
                dev->block_info_alt = 1;
-       } else
+       } else {
                dev->block_info_alt = 0;
+        }
 
        if (dev->block_info) {
                /* Set up dynamic blockinfo stuff. */
@@ -1719,8 +1720,9 @@ static int yaffs_init_blocks(struct yaffs_dev *dev)
                        dev->chunk_bits =
                            YMALLOC_ALT(dev->chunk_bit_stride * n_blocks);
                        dev->chunk_bits_alt = 1;
-               } else
+               } else {
                        dev->chunk_bits_alt = 0;
+                }
        }
 
        if (dev->block_info && dev->chunk_bits) {
@@ -2174,12 +2176,13 @@ static int yaffs_gc_block(struct yaffs_dev *dev, int block, int whole_block)
                                                                          oh,
                                                                          &tags,
                                                                          1);
-                                       } else
+                                       } else {
                                                new_chunk =
                                                    yaffs_write_new_chunk(dev,
                                                                          buffer,
                                                                          &tags,
                                                                          1);
+                                        }
 
                                        if (new_chunk < 0) {
                                                ret_val = YAFFS_FAIL;
@@ -2385,8 +2388,9 @@ static unsigned yaffs_find_gc_block(struct yaffs_dev *dev,
                        bi = yaffs_get_block_info(dev, selected);
                        dev->gc_pages_in_use =
                            bi->pages_in_use - bi->soft_del_pages;
-               } else
+               } else {
                        dev->gc_not_done = 0;
+                }
        }
 
        if (selected) {
@@ -2921,8 +2925,9 @@ int yaffs_update_oh(struct yaffs_obj *in, const YCHAR * name, int force,
 
                        memcpy(old_name, oh->name, sizeof(oh->name));
                        memset(buffer, 0xFF, sizeof(struct yaffs_obj_hdr));
-               } else
+               } else {
                        memset(buffer, 0xFF, dev->data_bytes_per_chunk);
+                }
 
                oh->type = in->variant_type;
                oh->yst_mode = in->yst_mode;
@@ -2938,10 +2943,11 @@ int yaffs_update_oh(struct yaffs_obj *in, const YCHAR * name, int force,
                if (name && *name) {
                        memset(oh->name, 0, sizeof(oh->name));
                        yaffs_load_oh_from_name(dev, oh->name, name);
-               } else if (prev_chunk_id > 0)
+               } else if (prev_chunk_id > 0) {
                        memcpy(oh->name, old_name, sizeof(oh->name));
-               else
+               } else {
                        memset(oh->name, 0, sizeof(oh->name));
+                }
 
                oh->is_shrink = is_shrink;
 
@@ -3210,9 +3216,9 @@ static struct yaffs_cache *yaffs_grab_chunk_cache(struct yaffs_dev *dev)
 
                }
                return cache;
-       } else
+       } else {
                return NULL;
-
+        }
 }
 
 /* Find a cached chunk */
@@ -3932,11 +3938,12 @@ static int yaffs_unlink_worker(struct yaffs_obj *obj)
                default:
                        return YAFFS_FAIL;
                }
-       } else if (yaffs_is_non_empty_dir(obj))
+       } else if (yaffs_is_non_empty_dir(obj)) {
                return YAFFS_FAIL;
-       else
+       } else {
                return yaffs_change_obj_name(obj, obj->my_dev->unlinked_dir,
                                             _Y("unlinked"), 0, 0);
+        }
 }
 
 static int yaffs_unlink_obj(struct yaffs_obj *obj)
@@ -4103,11 +4110,11 @@ static void yaffs_fix_hanging_objs(struct yaffs_dev *dev)
                                        hanging = 0;
                                } else if (!parent
                                           || parent->variant_type !=
-                                          YAFFS_OBJECT_TYPE_DIRECTORY)
+                                          YAFFS_OBJECT_TYPE_DIRECTORY) {
                                        hanging = 1;
-                               else if (yaffs_has_null_parent(dev, parent))
+                               } else if (yaffs_has_null_parent(dev, parent)) {
                                        hanging = 0;
-                               else {
+                               else {
                                        /*
                                         * Need to follow the parent chain to see if it is hanging.
                                         */
@@ -4248,8 +4255,9 @@ static void yaffs_update_parent(struct yaffs_obj *obj)
                           obj->obj_id));
                }
 
-       } else
+       } else {
                yaffs_update_oh(obj, NULL, 0, 0, 0, NULL);
+        }
 }
 
 void yaffs_update_dirty_dirs(struct yaffs_dev *dev)
@@ -4378,8 +4386,7 @@ struct yaffs_obj *yaffs_find_by_name(struct yaffs_obj *directory,
 
                        /* Special case for lost-n-found */
                        if (l->obj_id == YAFFS_OBJECTID_LOSTNFOUND) {
-                               if (yaffs_strcmp(name, YAFFS_LOSTNFOUND_NAME) ==
-                                   0)
+                               if (!yaffs_strcmp(name, YAFFS_LOSTNFOUND_NAME))
                                        return l;
                        } else if (yaffs_sum_cmp(l->sum, sum)
                                   || l->hdr_chunk <= 0) {
@@ -4468,11 +4475,15 @@ static void yaffs_load_name_from_oh(struct yaffs_dev *dev, YCHAR * name,
                                ascii_oh_name++;
                                n--;
                        }
-               } else
+               } else {
                        yaffs_strncpy(name, oh_name + 1, buff_size - 1);
-       } else
+                }
+       } else {
+#else
+        {
 #endif
                yaffs_strncpy(name, oh_name, buff_size - 1);
+        }
 }
 
 static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR * oh_name,
@@ -4511,9 +4522,12 @@ static void yaffs_load_oh_from_name(struct yaffs_dev *dev, YCHAR * oh_name,
                        yaffs_strncpy(oh_name + 1, name,
                                      YAFFS_MAX_NAME_LENGTH - 2);
                }
-       } else
+       } else {
+#else
+        {
 #endif
                yaffs_strncpy(oh_name, name, YAFFS_MAX_NAME_LENGTH - 1);
+        }
 
 }
 
@@ -4926,8 +4940,9 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
                        dev->tnode_width = 16;
                else
                        dev->tnode_width = bits;
-       } else
+       } else {
                dev->tnode_width = 16;
+        }
 
        dev->tnode_mask = (1 << dev->tnode_width) - 1;
 
@@ -5078,8 +5093,9 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
                                if (!init_failed && !yaffs2_scan_backwards(dev))
                                        init_failed = 1;
                        }
-               } else if (!yaffs1_scan(dev))
+               } else if (!yaffs1_scan(dev)) {
                        init_failed = 1;
+                }
 
                yaffs_strip_deleted_objs(dev);
                yaffs_fix_hanging_objs(dev);
index 555f937..26609f7 100644 (file)
@@ -71,8 +71,9 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk,
                                                            dev->
                                                            data_bytes_per_chunk);
                yaffs_pack_tags2_tags_only(pt2tp, tags);
-       } else
+       } else {
                yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc);
+        }
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
        ops.mode = MTD_OOB_AUTO;
index 00040cd..0835078 100644 (file)
@@ -67,8 +67,9 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk,
                                                            dev->
                                                            data_bytes_per_chunk);
                yaffs_pack_tags2_tags_only(pt2tp, tags);
-       } else
+       } else {
                yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc);
+        }
 
        ops.mode = MTD_OOB_AUTO;
        ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
index d7cb72a..d8c548a 100644 (file)
@@ -81,8 +81,9 @@ int nval_del(char *xb, int xb_size, const YCHAR * name)
                memcpy(xb + pos, xb + pos + size, xb_size - (pos + size));
                memset(xb + (xb_size - size), 0, size);
                return 0;
-       } else
+       } else {
                return -ENODATA;
+        }
 }
 
 int nval_set(char *xb, int xb_size, const YCHAR * name, const char *buf,
@@ -182,8 +183,9 @@ int nval_list(const char *xb, int xb_size, char *buf, int bsize)
                                buf++;
                        }
                        ncopied += (name_len + 1);
-               } else
+               } else {
                        filled = 1;
+                }
                pos += size;
                if (pos < xb_size - sizeof(int))
                        memcpy(&size, xb + pos, sizeof(int));
index 9e4e31a..0bb06f4 100644 (file)
@@ -2334,11 +2334,13 @@ static int yaffs_bg_thread_fn(void *data)
                                        next_gc = now + HZ / 10 + 1;
                                else
                                        next_gc = now + HZ * 2;
-                       } else  /*
+                       } else  {
+                               /*
                                 * gc not running so set to next_dir_update
                                 * to cut down on wake ups
                                 */
                                next_gc = next_dir_update;
+                        }
                }
                yaffs_gross_unlock(dev);
 #if 1
@@ -2605,9 +2607,9 @@ static int yaffs_parse_options(struct yaffs_options *options,
                        options_str++;
                }
 
-               if (!strcmp(cur_opt, "inband-tags"))
+               if (!strcmp(cur_opt, "inband-tags")) {
                        options->inband_tags = 1;
-               else if (!strcmp(cur_opt, "tags-ecc-off")) {
+               else if (!strcmp(cur_opt, "tags-ecc-off")) {
                        options->tags_ecc_on = 0;
                        options->tags_ecc_overridden = 1;
                } else if (!strcmp(cur_opt, "tags-ecc-on")) {
@@ -2625,13 +2627,13 @@ static int yaffs_parse_options(struct yaffs_options *options,
                } else if (!strcmp(cur_opt, "empty-lost-and-found-on")) {
                        options->empty_lost_and_found = 1;
                        options->empty_lost_and_found_overridden = 1;
-               } else if (!strcmp(cur_opt, "no-cache"))
+               } else if (!strcmp(cur_opt, "no-cache")) {
                        options->no_cache = 1;
-               else if (!strcmp(cur_opt, "no-checkpoint-read"))
+               } else if (!strcmp(cur_opt, "no-checkpoint-read")) {
                        options->skip_checkpoint_read = 1;
-               else if (!strcmp(cur_opt, "no-checkpoint-write"))
+               } else if (!strcmp(cur_opt, "no-checkpoint-write")) {
                        options->skip_checkpoint_write = 1;
-               else if (!strcmp(cur_opt, "no-checkpoint")) {
+               else if (!strcmp(cur_opt, "no-checkpoint")) {
                        options->skip_checkpoint_read = 1;
                        options->skip_checkpoint_write = 1;
                } else {
@@ -3268,8 +3270,9 @@ static int yaffs_proc_read(char *page,
                                    sprintf(buf, "\nDevice %d \"%s\"\n", n,
                                            dev->param.name);
                                buf = yaffs_dump_dev_part0(buf, dev);
-                       } else
+                       } else {
                                buf = yaffs_dump_dev_part1(buf, dev);
+                        }
 
                        break;
                }
@@ -3489,8 +3492,9 @@ static int __init init_yaffs_fs(void)
                my_proc_entry->write_proc = yaffs_proc_write;
                my_proc_entry->read_proc = yaffs_proc_read;
                my_proc_entry->data = NULL;
-       } else
+       } else {
                return -ENOMEM;
+        }
 
        debug_proc_entry = create_proc_entry("yaffs_stats",
                                             S_IRUGO | S_IFREG, YPROC_ROOT);
@@ -3499,8 +3503,9 @@ static int __init init_yaffs_fs(void)
                debug_proc_entry->write_proc = NULL;
                debug_proc_entry->read_proc = yaffs_stats_proc_read;
                debug_proc_entry->data = NULL;
-       } else
+       } else {
                return -ENOMEM;
+        }
 
        /* Now add the file system entries */
 
index a17262c..146aaef 100644 (file)
@@ -1890,11 +1890,13 @@ static int yaffs_bg_thread_fn(void *data)
                                        next_gc = now + HZ / 10 + 1;
                                else
                                        next_gc = now + HZ * 2;
-                       } else  /*
+                       } else  {
+                               /*
                                 * gc not running so set to next_dir_update
                                 * to cut down on wake ups
                                 */
                                next_gc = next_dir_update;
+                        }
                }
                yaffs_gross_unlock(dev);
                expires = next_dir_update;
@@ -2100,9 +2102,9 @@ static int yaffs_parse_options(struct yaffs_options *options,
                        options_str++;
                }
 
-               if (!strcmp(cur_opt, "inband-tags"))
+               if (!strcmp(cur_opt, "inband-tags")) {
                        options->inband_tags = 1;
-               else if (!strcmp(cur_opt, "tags-ecc-off")) {
+               else if (!strcmp(cur_opt, "tags-ecc-off")) {
                        options->tags_ecc_on = 0;
                        options->tags_ecc_overridden = 1;
                } else if (!strcmp(cur_opt, "tags-ecc-on")) {
@@ -2120,13 +2122,13 @@ static int yaffs_parse_options(struct yaffs_options *options,
                } else if (!strcmp(cur_opt, "empty-lost-and-found-on")) {
                        options->empty_lost_and_found = 1;
                        options->empty_lost_and_found_overridden = 1;
-               } else if (!strcmp(cur_opt, "no-cache"))
+               } else if (!strcmp(cur_opt, "no-cache")) {
                        options->no_cache = 1;
-               else if (!strcmp(cur_opt, "no-checkpoint-read"))
+               } else if (!strcmp(cur_opt, "no-checkpoint-read")) {
                        options->skip_checkpoint_read = 1;
-               else if (!strcmp(cur_opt, "no-checkpoint-write"))
+               } else if (!strcmp(cur_opt, "no-checkpoint-write")) {
                        options->skip_checkpoint_write = 1;
-               else if (!strcmp(cur_opt, "no-checkpoint")) {
+               else if (!strcmp(cur_opt, "no-checkpoint")) {
                        options->skip_checkpoint_read = 1;
                        options->skip_checkpoint_write = 1;
                } else {
@@ -2693,8 +2695,9 @@ static int yaffs_proc_read(char *page,
                                    sprintf(buf, "\nDevice %d \"%s\"\n", n,
                                            dev->param.name);
                                buf = yaffs_dump_dev_part0(buf, dev);
-                       } else
+                       } else {
                                buf = yaffs_dump_dev_part1(buf, dev);
+                        }
 
                        break;
                }
@@ -2914,8 +2917,9 @@ static int __init init_yaffs_fs(void)
                my_proc_entry->write_proc = yaffs_proc_write;
                my_proc_entry->read_proc = yaffs_proc_read;
                my_proc_entry->data = NULL;
-       } else
+       } else {
                return -ENOMEM;
+        }
 
        debug_proc_entry = create_proc_entry("yaffs_stats",
                                             S_IRUGO | S_IFREG, YPROC_ROOT);
@@ -2924,8 +2928,9 @@ static int __init init_yaffs_fs(void)
                debug_proc_entry->write_proc = NULL;
                debug_proc_entry->read_proc = yaffs_stats_proc_read;
                debug_proc_entry->data = NULL;
-       } else
+       } else {
                return -ENOMEM;
+        }
 
        /* Now add the file system entries */
 
index 4ab0f22..b6c43e5 100644 (file)
@@ -303,8 +303,7 @@ int yaffs1_scan(struct yaffs_dev *dev)
                                                               variant.dir_variant.children);
                                        } else if (!parent
                                                   || parent->variant_type !=
-                                                  YAFFS_OBJECT_TYPE_DIRECTORY)
-                                       {
+                                                  YAFFS_OBJECT_TYPE_DIRECTORY) {
                                                /* Hoosterman, another problem....
                                                 * We're trying to use a non-directory as a directory
                                                 */
index 97dac45..ad35fd5 100644 (file)
@@ -536,8 +536,9 @@ static int yaffs2_rd_checkpt_tnodes(struct yaffs_obj *obj)
                if (tn) {
                        ok = (yaffs2_checkpt_rd(dev, tn, dev->tnode_size) ==
                              dev->tnode_size);
-               } else
+               } else {
                        ok = 0;
+                }
 
                if (tn && ok)
                        ok = yaffs_add_find_tnode_0(dev,
@@ -632,9 +633,9 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev)
                    TENDSTR), cp.obj_id, cp.parent_id, cp.variant_type,
                   cp.hdr_chunk));
 
-               if (ok && cp.obj_id == ~0)
+               if (ok && cp.obj_id == ~0) {
                        done = 1;
-               else if (ok) {
+               else if (ok) {
                        obj =
                            yaffs_find_or_create_by_number(dev, cp.obj_id,
                                                           cp.variant_type);
@@ -650,8 +651,9 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev)
                                            (struct list_head *)hard_list;
                                        hard_list = obj;
                                }
-                       } else
+                       } else {
                                ok = 0;
+                        }
                }
        }
 
@@ -918,8 +920,9 @@ int yaffs2_handle_hole(struct yaffs_obj *obj, loff_t new_size)
                        if (written == this_write) {
                                pos += this_write;
                                increase -= this_write;
-                       } else
+                       } else {
                                small_increase_ok = 0;
+                        }
                }
 
                yaffs_release_temp_buffer(dev, local_buffer, __LINE__);
@@ -1410,9 +1413,9 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
                                                in->yst_mode = oh->yst_mode;
                                                yaffs_load_attribs(in, oh);
                                                in->lazy_loaded = 0;
-                                       } else
+                                       } else {
                                                in->lazy_loaded = 1;
-
+                                        }
                                        in->hdr_chunk = chunk;
 
                                } else if (!in->valid) {
@@ -1476,8 +1479,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
                                                               variant.dir_variant.children);
                                        } else if (!parent
                                                   || parent->variant_type !=
-                                                  YAFFS_OBJECT_TYPE_DIRECTORY)
-                                       {
+                                                  YAFFS_OBJECT_TYPE_DIRECTORY) {
                                                /* Hoosterman, another problem....
                                                 * We're trying to use a non-directory as a directory
                                                 */