Patchwork UBIFS: remove douple initialization in change_category()

login
register
mail settings
Submitter Dan Carpenter
Date April 1, 2012, 3:57 p.m.
Message ID <20120401155759.GA21238@elgon.mountain>
Download mbox | patch
Permalink /patch/149961/
State Accepted
Commit 273946a5c507ff5bce12349143470e8629bbe0a7
Headers show

Comments

Dan Carpenter - April 1, 2012, 3:57 p.m.
"heap" is initialized twice.  I removed the first one, because it makes
Smatch complain that we use "new_cat" as an offset before checking it.

This doesn't change how the code works, it's just a cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Artem Bityutskiy - April 13, 2012, 4:11 p.m.
On Sun, 2012-04-01 at 18:57 +0300, Dan Carpenter wrote:
> "heap" is initialized twice.  I removed the first one, because it makes
> Smatch complain that we use "new_cat" as an offset before checking it.
> 
> This doesn't change how the code works, it's just a cleanup.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Pushed to linux-ubifs.git, thanks!

Patch

diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index f8a181e..b5c95a6 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -447,7 +447,7 @@  static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops)
 	int new_cat = ubifs_categorize_lprops(c, lprops);
 
 	if (old_cat == new_cat) {
-		struct ubifs_lpt_heap *heap = &c->lpt_heap[new_cat - 1];
+		struct ubifs_lpt_heap *heap;
 
 		/* lprops on a heap now must be moved up or down */
 		if (new_cat < 1 || new_cat > LPROPS_HEAP_CNT)