aboutsummaryrefslogtreecommitdiffstats
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-07-16 02:41:28 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:50 -0400
commit4210df283cc703bc494f450c91b8311bdf7fe5ee (patch)
tree942e72f356f55dae8c8f6b3d4e6bc033a2191323 /fs/block_dev.c
parent4e91672c76319aaed24ea3e784e238cf445c57cb (diff)
bd_claim_by_disk: fix warning
Fix this: fs/block_dev.c: In function 'bd_claim_by_disk': fs/block_dev.c:970: warning: 'found' may be used uninitialized in this function and given that free_bd_holder() now needs free(NULL)-is-legal behaviour, we can simplify bd_release_from_kobject(). Cc: Bjorn Steinbrink <B.Steinbrink@gmx.de> Cc: Johannes Weiner <hannes-kernel@saeurebad.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 75c47a21b2f0..3635315e3b99 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -963,20 +963,20 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
963 963
964 err = bd_claim(bdev, holder); 964 err = bd_claim(bdev, holder);
965 if (err) 965 if (err)
966 goto out; 966 goto fail;
967 967
968 found = find_bd_holder(bdev, bo); 968 found = find_bd_holder(bdev, bo);
969 if (found) 969 if (found)
970 goto out; 970 goto fail;
971 971
972 err = add_bd_holder(bdev, bo); 972 err = add_bd_holder(bdev, bo);
973 if (err) 973 if (err)
974 bd_release(bdev); 974 bd_release(bdev);
975 975 else
976out: 976 bo = NULL;
977 if (err || found) 977fail:
978 free_bd_holder(bo);
979 mutex_unlock(&bdev->bd_mutex); 978 mutex_unlock(&bdev->bd_mutex);
979 free_bd_holder(bo);
980 return err; 980 return err;
981} 981}
982 982
@@ -991,15 +991,12 @@ out:
991static void bd_release_from_kobject(struct block_device *bdev, 991static void bd_release_from_kobject(struct block_device *bdev,
992 struct kobject *kobj) 992 struct kobject *kobj)
993{ 993{
994 struct bd_holder *bo;
995
996 if (!kobj) 994 if (!kobj)
997 return; 995 return;
998 996
999 mutex_lock(&bdev->bd_mutex); 997 mutex_lock(&bdev->bd_mutex);
1000 bd_release(bdev); 998 bd_release(bdev);
1001 if ((bo = del_bd_holder(bdev, kobj))) 999 free_bd_holder(del_bd_holder(bdev, kobj));
1002 free_bd_holder(bo);
1003 mutex_unlock(&bdev->bd_mutex); 1000 mutex_unlock(&bdev->bd_mutex);
1004} 1001}
1005 1002