From: Luis de Bethencourt <luisbg@osg.samsung.com>
To: Daeseok Youn <daeseok.youn@gmail.com>, 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
Date: Fri, 08 Jul 2016 17:58:06 +0000 [thread overview]
Message-ID: <577FE9AE.1010104@osg.samsung.com> (raw)
In-Reply-To: <20160704113645.GA10177@SEL-JYOUN-D1>
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 <daeseok.youn@gmail.com>
> ---
> 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
WARNING: multiple messages have this Message-ID (diff)
From: Luis de Bethencourt <luisbg@osg.samsung.com>
To: Daeseok Youn <daeseok.youn@gmail.com>, 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
Date: Fri, 08 Jul 2016 18:58:06 +0100 [thread overview]
Message-ID: <577FE9AE.1010104@osg.samsung.com> (raw)
In-Reply-To: <20160704113645.GA10177@SEL-JYOUN-D1>
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 <daeseok.youn@gmail.com>
> ---
> 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
next prev parent reply other threads:[~2016-07-08 17:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 11:36 [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in Daeseok Youn
2016-07-04 11:36 ` Daeseok Youn
2016-07-04 11:44 ` DaeSeok Youn
2016-07-04 11:44 ` DaeSeok Youn
2016-07-06 6:11 ` Daeseok Youn
2016-07-06 6:11 ` Daeseok Youn
2016-08-15 17:05 ` Greg KH
2016-08-15 17:05 ` Greg KH
2016-08-17 1:05 ` DaeSeok Youn
2016-08-17 1:05 ` DaeSeok Youn
2016-08-17 6:25 ` Greg KH
2016-08-17 6:25 ` Greg KH
2016-08-17 11:25 ` DaeSeok Youn
2016-08-17 11:25 ` DaeSeok Youn
2016-07-08 17:58 ` Luis de Bethencourt [this message]
2016-07-08 17:58 ` Luis de Bethencourt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=577FE9AE.1010104@osg.samsung.com \
--to=luisbg@osg.samsung.com \
--cc=daeseok.youn@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lidza.louina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.