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>
This commit is contained in:
parent
4e91672c76
commit
4210df283c
1 changed files with 7 additions and 10 deletions
|
@ -963,20 +963,20 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
|
||||||
|
|
||||||
err = bd_claim(bdev, holder);
|
err = bd_claim(bdev, holder);
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto fail;
|
||||||
|
|
||||||
found = find_bd_holder(bdev, bo);
|
found = find_bd_holder(bdev, bo);
|
||||||
if (found)
|
if (found)
|
||||||
goto out;
|
goto fail;
|
||||||
|
|
||||||
err = add_bd_holder(bdev, bo);
|
err = add_bd_holder(bdev, bo);
|
||||||
if (err)
|
if (err)
|
||||||
bd_release(bdev);
|
bd_release(bdev);
|
||||||
|
else
|
||||||
out:
|
bo = NULL;
|
||||||
if (err || found)
|
fail:
|
||||||
free_bd_holder(bo);
|
|
||||||
mutex_unlock(&bdev->bd_mutex);
|
mutex_unlock(&bdev->bd_mutex);
|
||||||
|
free_bd_holder(bo);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,15 +991,12 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
|
||||||
static void bd_release_from_kobject(struct block_device *bdev,
|
static void bd_release_from_kobject(struct block_device *bdev,
|
||||||
struct kobject *kobj)
|
struct kobject *kobj)
|
||||||
{
|
{
|
||||||
struct bd_holder *bo;
|
|
||||||
|
|
||||||
if (!kobj)
|
if (!kobj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_lock(&bdev->bd_mutex);
|
mutex_lock(&bdev->bd_mutex);
|
||||||
bd_release(bdev);
|
bd_release(bdev);
|
||||||
if ((bo = del_bd_holder(bdev, kobj)))
|
free_bd_holder(del_bd_holder(bdev, kobj));
|
||||||
free_bd_holder(bo);
|
|
||||||
mutex_unlock(&bdev->bd_mutex);
|
mutex_unlock(&bdev->bd_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue