Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752209AbdGIMcg (ORCPT ); Sun, 9 Jul 2017 08:32:36 -0400 Received: from mail-wr0-f171.google.com ([209.85.128.171]:32858 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751774AbdGIMcf (ORCPT ); Sun, 9 Jul 2017 08:32:35 -0400 Date: Sun, 9 Jul 2017 13:32:31 +0100 From: Okash Khawaja To: Greg Kroah-Hartman , Jiri Slaby , Samuel Thibault , Alan Cox , linux-kernel@vger.kernel.org Cc: William Hubbs , Chris Brannon , Kirk Reiser , speakup@linux-speakup.org, devel@driverdev.osuosl.org Subject: [patch 4/3] tty: make tty_kopen return ENODEV in case of no TTY Message-ID: <20170709123231.GA10908@sanghar> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170709114153.157783481@gmail.com> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 743 Lines: 21 When TTY is not built, tty_kopen should return an error. This way calling code remains consistent, regardless of whether tty is built or not. This patch returns -ENODEV when there is no tty. Signed-off-by: Okash Khawaja --- include/linux/tty.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -423,7 +423,7 @@ static inline int __init tty_init(void) static inline const char *tty_name(const struct tty_struct *tty) { return "(none)"; } static inline struct tty_struct *tty_kopen(dev_t device) -{ return NULL; } +{ return ERR_PTR(-ENODEV); } static inline int tty_dev_name_to_number(const char *name, dev_t *number) { return -ENOTSUPP; } #endif