From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Shevchenko Date: Thu, 11 Feb 2021 17:09:37 +0200 Subject: [PATCH v1 04/11] console: Switch to use stdio_file_to_flags() In-Reply-To: <20210211150944.73252-1-andriy.shevchenko@linux.intel.com> References: <20210211150944.73252-1-andriy.shevchenko@linux.intel.com> Message-ID: <20210211150944.73252-4-andriy.shevchenko@linux.intel.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Deduplicate code by replacing with stdio_file_to_flags() helper. Signed-off-by: Andy Shevchenko --- common/console.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/common/console.c b/common/console.c index f3cc45cab548..b1c3ed17cc03 100644 --- a/common/console.c +++ b/common/console.c @@ -854,17 +854,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 */ -- 2.30.0