Commit e74c2ddc authored by Daeseok Youn's avatar Daeseok Youn Committed by Greg Kroah-Hartman

staging: dgap: remove bogus null test in dgap_tty_init()

- The channels array were set to NULL in dgap_found_board().
- Removes redundant null check for channels array in for loop,
if one of the channel cannot be allocated, dgap_tty_init() just returns
an error.
Signed-off-by: default avatarDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f86c55c9
...@@ -1379,12 +1379,10 @@ static int dgap_tty_init(struct board_t *brd) ...@@ -1379,12 +1379,10 @@ static int dgap_tty_init(struct board_t *brd)
* when the driver was first loaded. * when the driver was first loaded.
*/ */
for (i = 0; i < brd->nasync; i++) { for (i = 0; i < brd->nasync; i++) {
if (!brd->channels[i]) { brd->channels[i] =
brd->channels[i] = kzalloc(sizeof(struct channel_t), GFP_KERNEL);
kzalloc(sizeof(struct channel_t), GFP_KERNEL); if (!brd->channels[i])
if (!brd->channels[i]) return -ENOMEM;
return -ENOMEM;
}
} }
ch = brd->channels[0]; ch = brd->channels[0];
...@@ -1398,9 +1396,6 @@ static int dgap_tty_init(struct board_t *brd) ...@@ -1398,9 +1396,6 @@ static int dgap_tty_init(struct board_t *brd)
/* Set up channel variables */ /* Set up channel variables */
for (i = 0; i < brd->nasync; i++, ch = brd->channels[i], bs++) { for (i = 0; i < brd->nasync; i++, ch = brd->channels[i], bs++) {
if (!brd->channels[i])
continue;
spin_lock_init(&ch->ch_lock); spin_lock_init(&ch->ch_lock);
/* Store all our magic numbers */ /* Store all our magic numbers */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment