Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1436421 > unrolled thread

[PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in

Started byDaeseok Youn <daeseok.youn@gmail.com>
First post2016-07-04 13:40 +0200
Last post2016-07-08 20:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in Daeseok Youn <daeseok.youn@gmail.com> - 2016-07-04 13:40 +0200
    Re: [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in DaeSeok Youn <daeseok.youn@gmail.com> - 2016-07-04 13:50 +0200
    Re: [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks  in Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-07-08 20:00 +0200

#1436421 — [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in

FromDaeseok Youn <daeseok.youn@gmail.com>
Date2016-07-04 13:40 +0200
Subject[PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in
Message-ID<rRaoi-52n-29@gated-at.bofh.it>
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);
-- 
1.9.1

[toc] | [next] | [standalone]


#1436426

FromDaeSeok Youn <daeseok.youn@gmail.com>
Date2016-07-04 13:50 +0200
Message-ID<rRaxY-55H-5@gated-at.bofh.it>
In reply to#1436421
2016-07-04 20:36 GMT+09:00 Daeseok Youn <daeseok.youn@gmail.com>:
> 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);
> --
> 1.9.1
>
This patch will be sent again, I made a mistake while gathering my
previous patches which didn't accepted for a long time.
Sorry for noise.

Thanks.

Regards,
Jake.

[toc] | [prev] | [next] | [standalone]


#1439726 — Re: [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in

FromLuis de Bethencourt <luisbg@osg.samsung.com>
Date2016-07-08 20:00 +0200
SubjectRe: [PATCH 01/15 RESEND] staging: dgnc: remove redundant NULL checks in
Message-ID<rSIed-7ZA-7@gated-at.bofh.it>
In reply to#1436421
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web