Skip to contentSkip to conversation

staging: dgnc: remove redundant NULL checks in

PATCH RESEND Superseded Daeseok Youn 1 participant 3 messages May 10, 2016 – Jun 21, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/2 staging: dgnc: remove redundant NULL checks in

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().

---
RESEND: more explanation about this patch.
origin patch : https://lkml.org/lkml/2016/5/4/12

 drivers/staging/dgnc/dgnc_tty.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +2 -7
index a505775..cff34d4 100644
@@ -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);
Signature · 1 line
2.8.2
#1 lore raw

2016-05-10 15:44 GMT+09:00 Daeseok Youn <[email protected]>:

Quoted 7 lines

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().

---

Hello Greg,

This patch and patches from this were not merged into your tree for a one month. Can you tell me why these are still waiting to merge?

Thanks.
regards,
Daeseok.

Quoted 33 lines

RESEND: more explanation about this patch.
origin patch : https://lkml.org/lkml/2016/5/4/12

 drivers/staging/dgnc/dgnc_tty.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +2 -8
index a505775..cff34d4 100644
@@ -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);
--

2.8.2

#2 lore raw

2016-06-16 18:23 GMT+09:00 DaeSeok Youn <[email protected]>:

Quoted 6 lines

2016-05-10 15:44 GMT+09:00 Daeseok Youn <[email protected]>:

Quoted 5 lines

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().

Quoted 6 lines
Quoted 2 lines

---

Hello Greg,

This patch and patches from this were not merged into your tree for a one month. Can you tell me why these are still waiting to merge?

Hello Greg,

Please have a look my comment. My patches have been waiting to merge your staging tree for a month.
If you don't have pending patches from me, I can send those again.

Thanks.
regards,
Daeseok.

Quoted 39 lines

Thanks.
regards,
Daeseok.

Quoted 33 lines

RESEND: more explanation about this patch.
origin patch : https://lkml.org/lkml/2016/5/4/12

 drivers/staging/dgnc/dgnc_tty.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +2 -8
index a505775..cff34d4 100644
@@ -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);
--

2.8.2