summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2021-02-11 17:09:37 +0200
committerTom Rini <trini@konsulko.com>2021-02-16 11:16:07 -0500
commit7b9ca3f89c340f3a195e17ccdd7d512e0884e555 (patch)
tree4829667af35dff505a36ff3bbdcc462a42c4c1cf /common
parentd9b0ac90baf499d215462ed7afffbfd22a58340b (diff)
downloadu-boot-7b9ca3f89c340f3a195e17ccdd7d512e0884e555.tar.gz
u-boot-7b9ca3f89c340f3a195e17ccdd7d512e0884e555.tar.bz2
u-boot-7b9ca3f89c340f3a195e17ccdd7d512e0884e555.zip
console: Switch to use stdio_file_to_flags()
Deduplicate code by replacing with stdio_file_to_flags() helper. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'common')
-rw-r--r--common/console.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/common/console.c b/common/console.c
index 567273a0ce..b1afb650ed 100644
--- a/common/console.c
+++ b/common/console.c
@@ -855,17 +855,9 @@ int console_assign(int file, const char *devname)
struct stdio_dev *dev;
/* Check for valid file */
- switch (file) {
- case stdin:
- flag = DEV_FLAGS_INPUT;
- break;
- case stdout:
- case stderr:
- flag = DEV_FLAGS_OUTPUT;
- break;
- default:
- return -1;
- }
+ flag = stdio_file_to_flags(file);
+ if (flag < 0)
+ return flag;
/* Check for valid device name */