]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/block_dev.c
[ARM] 4549/1: KS8695: Fix build errors
[linux-2.6-omap-h63xx.git] / fs / block_dev.c
index da5f0515e8eba4dfb4faee5885f5932a4c836fb8..2980eabe577981c0852a9286eea9be4474143687 100644 (file)
@@ -517,7 +517,7 @@ void __init bdev_cache_init(void)
        bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
                        0, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
                                SLAB_MEM_SPREAD|SLAB_PANIC),
-                       init_once, NULL);
+                       init_once);
        err = register_filesystem(&bd_type);
        if (err)
                panic("Cannot register bdev pseudo-fs");
@@ -872,7 +872,7 @@ static struct bd_holder *find_bd_holder(struct block_device *bdev,
  */
 static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
 {
-       int ret;
+       int err;
 
        if (!bo)
                return -EINVAL;
@@ -880,15 +880,18 @@ static int add_bd_holder(struct block_device *bdev, struct bd_holder *bo)
        if (!bd_holder_grab_dirs(bdev, bo))
                return -EBUSY;
 
-       ret = add_symlink(bo->sdir, bo->sdev);
-       if (ret == 0) {
-               ret = add_symlink(bo->hdir, bo->hdev);
-               if (ret)
-                       del_symlink(bo->sdir, bo->sdev);
+       err = add_symlink(bo->sdir, bo->sdev);
+       if (err)
+               return err;
+
+       err = add_symlink(bo->hdir, bo->hdev);
+       if (err) {
+               del_symlink(bo->sdir, bo->sdev);
+               return err;
        }
-       if (ret == 0)
-               list_add_tail(&bo->list, &bdev->bd_holder_list);
-       return ret;
+
+       list_add_tail(&bo->list, &bdev->bd_holder_list);
+       return 0;
 }
 
 /**
@@ -946,7 +949,7 @@ static struct bd_holder *del_bd_holder(struct block_device *bdev,
 static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
                                struct kobject *kobj)
 {
-       int res;
+       int err;
        struct bd_holder *bo, *found;
 
        if (!kobj)
@@ -957,21 +960,24 @@ static int bd_claim_by_kobject(struct block_device *bdev, void *holder,
                return -ENOMEM;
 
        mutex_lock(&bdev->bd_mutex);
-       res = bd_claim(bdev, holder);
-       if (res == 0) {
-               found = find_bd_holder(bdev, bo);
-               if (found == NULL) {
-                       res = add_bd_holder(bdev, bo);
-                       if (res)
-                               bd_release(bdev);
-               }
-       }
 
-       if (res || found)
-               free_bd_holder(bo);
-       mutex_unlock(&bdev->bd_mutex);
+       err = bd_claim(bdev, holder);
+       if (err)
+               goto fail;
 
-       return res;
+       found = find_bd_holder(bdev, bo);
+       if (found)
+               goto fail;
+
+       err = add_bd_holder(bdev, bo);
+       if (err)
+               bd_release(bdev);
+       else
+               bo = NULL;
+fail:
+       mutex_unlock(&bdev->bd_mutex);
+       free_bd_holder(bo);
+       return err;
 }
 
 /**
@@ -985,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,
                                        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);
 }