Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757924AbcDEJaf (ORCPT ); Tue, 5 Apr 2016 05:30:35 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33093 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756592AbcDEJad (ORCPT ); Tue, 5 Apr 2016 05:30:33 -0400 Date: Tue, 5 Apr 2016 18:30:02 +0900 From: Daeseok Youn To: lidza.louina@gmail.com Cc: markh@compro.net, gregkh@linuxfoundation.org, driverdev-devel@linuxdriverproject.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 2/2] staging: dgnc: remove redundant NULL check in Message-ID: <20160405093002.GA25395@SEL-JYOUN-D1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1036 Lines: 36 There were already checking NULL about channel_t / un_t before calling dgnc_maxcps_room(). Signed-off-by: Daeseok Youn --- drivers/staging/dgnc/dgnc_tty.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index e97faaa..200d3aa 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -1536,19 +1536,8 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty) */ static int dgnc_maxcps_room(struct tty_struct *tty, int bytes_available) { - struct channel_t *ch = NULL; - struct un_t *un = NULL; - - if (!tty) - return bytes_available; - - un = tty->driver_data; - if (!un || un->magic != DGNC_UNIT_MAGIC) - return bytes_available; - - ch = un->un_ch; - if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) - return bytes_available; + struct un_t *un = tty->driver_data; + struct channel_t *ch = un->un_ch; /* * If its not the Transparent print device, return -- 1.9.1