bcache: fix error info in register_bcache()
[linux-2.6-microblaze.git] / drivers / md / bcache / super.c
index f2874c7..62b0140 100644 (file)
@@ -2617,8 +2617,11 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
        if (SB_IS_BDEV(sb)) {
                struct cached_dev *dc = kzalloc(sizeof(*dc), GFP_KERNEL);
 
-               if (!dc)
+               if (!dc) {
+                       ret = -ENOMEM;
+                       err = "cannot allocate memory";
                        goto out_put_sb_page;
+               }
 
                mutex_lock(&bch_register_lock);
                ret = register_bdev(sb, sb_disk, bdev, dc);
@@ -2629,11 +2632,15 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,
        } else {
                struct cache *ca = kzalloc(sizeof(*ca), GFP_KERNEL);
 
-               if (!ca)
+               if (!ca) {
+                       ret = -ENOMEM;
+                       err = "cannot allocate memory";
                        goto out_put_sb_page;
+               }
 
                /* blkdev_put() will be called in bch_cache_release() */
-               if (register_cache(sb, sb_disk, bdev, ca) != 0)
+               ret = register_cache(sb, sb_disk, bdev, ca);
+               if (ret)
                        goto out_free_sb;
        }
 
@@ -2750,7 +2757,7 @@ static int bcache_reboot(struct notifier_block *n, unsigned long code, void *x)
                 * The reason bch_register_lock is not held to call
                 * bch_cache_set_stop() and bcache_device_stop() is to
                 * avoid potential deadlock during reboot, because cache
-                * set or bcache device stopping process will acqurie
+                * set or bcache device stopping process will acquire
                 * bch_register_lock too.
                 *
                 * We are safe here because bcache_is_reboot sets to