Commit e7af9387 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: rtas_call was calling kmalloc too early

At present rtas_call() can be called before the kmalloc subsystem is
initialized, and if RTAS reports a hardware error, the code tries to do a
kmalloc to make a copy of the error report.  This patch changes it so that
we don't do the kmalloc in that situation.
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 08b38d38
......@@ -167,9 +167,12 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
/* Log the error in the unlikely case that there was one. */
if (unlikely(logit)) {
buff_copy = rtas_err_buf;
if (mem_init_done) {
buff_copy = kmalloc(RTAS_ERROR_LOG_MAX, GFP_ATOMIC);
if (buff_copy) {
memcpy(buff_copy, rtas_err_buf, RTAS_ERROR_LOG_MAX);
if (buff_copy)
memcpy(buff_copy, rtas_err_buf,
RTAS_ERROR_LOG_MAX);
}
}
......@@ -178,6 +181,7 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
if (buff_copy) {
log_error(buff_copy, ERR_TYPE_RTAS_LOG, 0);
if (mem_init_done)
kfree(buff_copy);
}
return ret;
......
......@@ -128,6 +128,8 @@ static inline void flush_altivec_to_thread(struct task_struct *t)
}
#endif
extern int mem_init_done; /* set on boot once kmalloc can be called */
/* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */
extern unsigned char e2a(unsigned char);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment