Merge tag 'armsoc-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[linux-2.6-block.git] / kernel / locking / qspinlock_stat.h
index d734b750200180afc91d9f5d2015f1cb27aa6032..22e02530984574a6fee718aad26720516c34d497 100644 (file)
@@ -191,8 +191,6 @@ static ssize_t qstat_write(struct file *file, const char __user *user_buf,
 
                for (i = 0 ; i < qstat_num; i++)
                        WRITE_ONCE(ptr[i], 0);
-               for (i = 0 ; i < qstat_num; i++)
-                       WRITE_ONCE(ptr[i], 0);
        }
        return count;
 }
@@ -214,10 +212,8 @@ static int __init init_qspinlock_stat(void)
        struct dentry *d_qstat = debugfs_create_dir("qlockstat", NULL);
        int i;
 
-       if (!d_qstat) {
-               pr_warn("Could not create 'qlockstat' debugfs directory\n");
-               return 0;
-       }
+       if (!d_qstat)
+               goto out;
 
        /*
         * Create the debugfs files
@@ -227,12 +223,20 @@ static int __init init_qspinlock_stat(void)
         * performance.
         */
        for (i = 0; i < qstat_num; i++)
-               debugfs_create_file(qstat_names[i], 0400, d_qstat,
-                                  (void *)(long)i, &fops_qstat);
+               if (!debugfs_create_file(qstat_names[i], 0400, d_qstat,
+                                        (void *)(long)i, &fops_qstat))
+                       goto fail_undo;
+
+       if (!debugfs_create_file(qstat_names[qstat_reset_cnts], 0200, d_qstat,
+                                (void *)(long)qstat_reset_cnts, &fops_qstat))
+               goto fail_undo;
 
-       debugfs_create_file(qstat_names[qstat_reset_cnts], 0200, d_qstat,
-                          (void *)(long)qstat_reset_cnts, &fops_qstat);
        return 0;
+fail_undo:
+       debugfs_remove_recursive(d_qstat);
+out:
+       pr_warn("Could not create 'qlockstat' debugfs entries\n");
+       return -ENOMEM;
 }
 fs_initcall(init_qspinlock_stat);