mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 23:36:23 +09:00
a8146f1490
commit fb033c95c94ca1ee3d16e04ebdb85d65fb55fff8 upstream. The system currently warns if the config conditions for building return_address in arch/arm/kernel/return_address.c are not met, leaving just an EXPORT_SYMBOL_GPL(return_address) of a function defined to be 'static linline'. This is a result ofaeea3592a1
("ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h"). Since we're not going to build anything other than an exported symbol for something that is already being defined to be an inline-able return of NULL, just avoid building the code to remove the following warning: Fixes:aeea3592a1
("ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h") Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
55 lines
1.0 KiB
C
55 lines
1.0 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* arch/arm/kernel/return_address.c
|
|
*
|
|
* Copyright (C) 2009 Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
|
|
* for Pengutronix
|
|
*/
|
|
#include <linux/export.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/sched.h>
|
|
|
|
#include <asm/stacktrace.h>
|
|
|
|
struct return_address_data {
|
|
unsigned int level;
|
|
void *addr;
|
|
};
|
|
|
|
static int save_return_addr(struct stackframe *frame, void *d)
|
|
{
|
|
struct return_address_data *data = d;
|
|
|
|
if (!data->level) {
|
|
data->addr = (void *)frame->pc;
|
|
|
|
return 1;
|
|
} else {
|
|
--data->level;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
void *return_address(unsigned int level)
|
|
{
|
|
struct return_address_data data;
|
|
struct stackframe frame;
|
|
|
|
data.level = level + 2;
|
|
data.addr = NULL;
|
|
|
|
frame.fp = (unsigned long)__builtin_frame_address(0);
|
|
frame.sp = current_stack_pointer;
|
|
frame.lr = (unsigned long)__builtin_return_address(0);
|
|
frame.pc = (unsigned long)return_address;
|
|
|
|
walk_stackframe(&frame, save_return_addr, &data);
|
|
|
|
if (!data.level)
|
|
return data.addr;
|
|
else
|
|
return NULL;
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(return_address);
|