lkml.org 
[lkml]   [2018]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] fs/UBIFS: make 'sum' definition closer to where it is used
Date
Local var sum is only used in one branch, and it may be not used if 
it is defined outside the branch. Try to move the definition into
the branch to make it closer to where it is actually used.

Signed-off-by: Liu Song <liu.song11@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
---
fs/ubifs/find.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index 2dcf3d4..4eb11c1 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -233,7 +233,7 @@ static const struct ubifs_lprops *scan_for_dirty(struct ubifs_info *c,
int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
int min_space, int pick_free)
{
- int err = 0, sum, exclude_index = pick_free == 2 ? 1 : 0;
+ int err = 0, exclude_index = pick_free == 2 ? 1 : 0;
const struct ubifs_lprops *lp = NULL, *idx_lp = NULL;
struct ubifs_lpt_heap *heap, *idx_heap;

@@ -285,6 +285,7 @@ int ubifs_find_dirty_leb(struct ubifs_info *c, struct ubifs_lprops *ret_lp,
idx_heap = &c->lpt_heap[LPROPS_DIRTY_IDX - 1];

if (idx_heap->cnt && !exclude_index) {
+ int sum;
idx_lp = idx_heap->arr[0];
sum = idx_lp->free + idx_lp->dirty;
/*
--
1.8.3.1
\
 
 \ /
  Last update: 2018-02-28 03:45    [W:0.126 / U:1.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site