From 1931d433d7a641e6a366854566ab1207a32972a6 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Tue, 12 Nov 2013 15:11:31 -0800 Subject: gcov: reuse kbasename helper To get name of the file from a pathname let's use kbasename() helper. Signed-off-by: Andy Shevchenko Cc: Jingoo Han Cc: Peter Oberparleiter Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/gcov/fs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'kernel') diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c index e892ad9ea065..15ff01a76379 100644 --- a/kernel/gcov/fs.c +++ b/kernel/gcov/fs.c @@ -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]) -- cgit v1.2.3