Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1397731 > unrolled thread
| Started by | Daeseok Youn <daeseok.youn@gmail.com> |
|---|---|
| First post | 2016-05-10 08:50 +0200 |
| Last post | 2016-05-10 08:50 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH 1/2 RESEND] staging: dgnc: remove redundant NULL checks in Daeseok Youn <daeseok.youn@gmail.com> - 2016-05-10 08:50 +0200
| From | Daeseok Youn <daeseok.youn@gmail.com> |
|---|---|
| Date | 2016-05-10 08:50 +0200 |
| Subject | [PATCH 1/2 RESEND] staging: dgnc: remove redundant NULL checks in |
| Message-ID | <rx9Eu-5o7-3@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>
---
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(-)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index a505775..cff34d4 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);
--
2.8.2
Back to top | Article view | linux.kernel
csiph-web