Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4210df283cc703bc494f450c91b8311bdf7fe5ee
Commit:     4210df283cc703bc494f450c91b8311bdf7fe5ee
Parent:     4e91672c76319aaed24ea3e784e238cf445c57cb
Author:     Andrew Morton <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:41:28 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:50 2007 -0700

    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 <[EMAIL PROTECTED]>
    Cc: Johannes Weiner <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/block_dev.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 75c47a2..3635315 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,
 
        err = bd_claim(bdev, holder);
        if (err)
-               goto out;
+               goto fail;
 
        found = find_bd_holder(bdev, bo);
        if (found)
-               goto out;
+               goto fail;
 
        err = add_bd_holder(bdev, bo);
        if (err)
                bd_release(bdev);
-
-out:
-       if (err || found)
-               free_bd_holder(bo);
+       else
+               bo = NULL;
+fail:
        mutex_unlock(&bdev->bd_mutex);
+       free_bd_holder(bo);
        return err;
 }
 
@@ -991,15 +991,12 @@ out:
 static void bd_release_from_kobject(struct block_device *bdev,
                                        struct kobject *kobj)
 {
-       struct bd_holder *bo;
-
        if (!kobj)
                return;
 
        mutex_lock(&bdev->bd_mutex);
        bd_release(bdev);
-       if ((bo = del_bd_holder(bdev, kobj)))
-               free_bd_holder(bo);
+       free_bd_holder(del_bd_holder(bdev, kobj));
        mutex_unlock(&bdev->bd_mutex);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to