treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / boot / ofconsole.c
blob8eb0f1c452c5297b06f15fd5fae7d428e5b7590f
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * OF console routines
5 * Copyright (C) Paul Mackerras 1997.
6 */
7 #include <stddef.h>
8 #include "types.h"
9 #include "elf.h"
10 #include "string.h"
11 #include "stdio.h"
12 #include "page.h"
13 #include "ops.h"
15 #include "of.h"
17 static unsigned int of_stdout_handle;
19 static int of_console_open(void)
21 void *devp;
23 if (((devp = of_finddevice("/chosen")) != NULL)
24 && (of_getprop(devp, "stdout", &of_stdout_handle,
25 sizeof(of_stdout_handle))
26 == sizeof(of_stdout_handle))) {
27 of_stdout_handle = be32_to_cpu(of_stdout_handle);
28 return 0;
31 return -1;
34 static void of_console_write(const char *buf, int len)
36 of_call_prom("write", 3, 1, of_stdout_handle, buf, len);
39 void of_console_init(void)
41 console_ops.open = of_console_open;
42 console_ops.write = of_console_write;