From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932758AbcGHR6S (ORCPT ); Fri, 8 Jul 2016 13:58:18 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:46187 "EHLO s-opensource.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755163AbcGHR6L (ORCPT ); Fri, 8 Jul 2016 13:58:11 -0400 Message-ID: <577FE9AE.1010104@osg.samsung.com> Date: Fri, 08 Jul 2016 18:58:06 +0100 From: Luis de Bethencourt User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Daeseok Youn , lidza.louina@gmail.com CC: devel@driverdev.osuosl.org, gregkh@linuxfoundation.org, driverdev-devel@linuxdriverproject.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in References: <20160704113645.GA10177@SEL-JYOUN-D1> In-Reply-To: <20160704113645.GA10177@SEL-JYOUN-D1> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/07/16 12:36, Daeseok Youn wrote: > The dgnc_block_til_ready() is only used in dgnc_tty_open(). > The unit data(struct un_t) was stored into tty->driver_data in dgnc_tty_open(). > And also tty and un were tested about NULL so these variables doesn't > need to check for NULL in dgnc_block_til_ready(). > > Signed-off-by: Daeseok Youn > --- > This patch seems to be missed for a long time. > I resend this patch without any updates. > > drivers/staging/dgnc/dgnc_tty.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c > index 4eeecc9..6758859 100644 > --- a/drivers/staging/dgnc/dgnc_tty.c > +++ b/drivers/staging/dgnc/dgnc_tty.c > @@ -1172,17 +1172,12 @@ static int dgnc_block_til_ready(struct tty_struct *tty, > struct channel_t *ch) > { > int retval = 0; > - struct un_t *un = NULL; > + struct un_t *un = tty->driver_data; > unsigned long flags; > uint old_flags = 0; > int sleep_on_un_flags = 0; > > - if (!tty || tty->magic != TTY_MAGIC || !file || !ch || > - ch->magic != DGNC_CHANNEL_MAGIC) > - return -ENXIO; > - > - un = tty->driver_data; > - if (!un || un->magic != DGNC_UNIT_MAGIC) > + if (!file) > return -ENXIO; > > spin_lock_irqsave(&ch->ch_lock, flags); > Hi, Just curious. Are you confident of removing the tty->magic != TTY_MAGIC check? >>From what I've seen that one can catch potential errors. I might be wrong. Thanks, Luis