gcov: reuse kbasename helper
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 12 Nov 2013 23:11:31 +0000 (15:11 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Nov 2013 03:09:34 +0000 (12:09 +0900)
To get name of the file from a pathname let's use kbasename() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jingoo Han <jg1.han@samsung.com>
Cc: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/gcov/fs.c

index e892ad9ea06509ed15b11734a39885ac3a19b700..15ff01a7637912776f16f534e64d9e3f0d002afe 100644 (file)
@@ -365,7 +365,7 @@ static const char *deskew(const char *basename)
  */
 static void add_links(struct gcov_node *node, struct dentry *parent)
 {
-       char *basename;
+       const char *basename;
        char *target;
        int num;
        int i;
@@ -381,10 +381,9 @@ static void add_links(struct gcov_node *node, struct dentry *parent)
                                &gcov_link[i]);
                if (!target)
                        goto out_err;
-               basename = strrchr(target, '/');
-               if (!basename)
+               basename = kbasename(target);
+               if (basename == target)
                        goto out_err;
-               basename++;
                node->links[i] = debugfs_create_symlink(deskew(basename),
                                                        parent, target);
                if (!node->links[i])