Skip to content

Commit 0cc96a7

Browse files
andy-shevcmetcalf-tilera
authored andcommitted
arch: tile: re-use kbasename() helper
kbasename() returns the filename part of a pathname. Signed-off-by: Andy Shevchenko <[email protected]>
1 parent f862eef commit 0cc96a7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

arch/tile/kernel/stack.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/mmzone.h>
2424
#include <linux/dcache.h>
2525
#include <linux/fs.h>
26+
#include <linux/string.h>
2627
#include <asm/backtrace.h>
2728
#include <asm/page.h>
2829
#include <asm/ucontext.h>
@@ -332,21 +333,18 @@ static void describe_addr(struct KBacktraceIterator *kbt,
332333
}
333334

334335
if (vma->vm_file) {
335-
char *s;
336336
p = d_path(&vma->vm_file->f_path, buf, bufsize);
337337
if (IS_ERR(p))
338338
p = "?";
339-
s = strrchr(p, '/');
340-
if (s)
341-
p = s+1;
339+
name = kbasename(p);
342340
} else {
343-
p = "anon";
341+
name = "anon";
344342
}
345343

346344
/* Generate a string description of the vma info. */
347-
namelen = strlen(p);
345+
namelen = strlen(name);
348346
remaining = (bufsize - 1) - namelen;
349-
memmove(buf, p, namelen);
347+
memmove(buf, name, namelen);
350348
snprintf(buf + namelen, remaining, "[%lx+%lx] ",
351349
vma->vm_start, vma->vm_end - vma->vm_start);
352350
}

0 commit comments

Comments
 (0)