Commit 9a133a90 authored by Mark Hounschell's avatar Mark Hounschell Committed by Greg Kroah-Hartman

staging: dgap: misc cleanup of NULL conditionals

refactors NULL conditionals
Signed-off-by: default avatarMark Hounschell <markh@compro.net>
Tested-by: default avatarMark Hounschell <markh@compro.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 28cda5ae
...@@ -2318,7 +2318,7 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty) ...@@ -2318,7 +2318,7 @@ static int dgap_tty_chars_in_buffer(struct tty_struct *tty)
ulong lock_flags = 0; ulong lock_flags = 0;
ulong lock_flags2 = 0; ulong lock_flags2 = 0;
if (tty == NULL) if (!tty)
return 0; return 0;
un = tty->driver_data; un = tty->driver_data;
...@@ -2464,7 +2464,7 @@ static int dgap_maxcps_room(struct tty_struct *tty, int bytes_available) ...@@ -2464,7 +2464,7 @@ static int dgap_maxcps_room(struct tty_struct *tty, int bytes_available)
struct channel_t *ch; struct channel_t *ch;
struct un_t *un; struct un_t *un;
if (tty == NULL) if (!tty)
return bytes_available; return bytes_available;
un = tty->driver_data; un = tty->driver_data;
...@@ -4140,12 +4140,12 @@ static int dgap_tty_register_ports(struct board_t *brd) ...@@ -4140,12 +4140,12 @@ static int dgap_tty_register_ports(struct board_t *brd)
brd->serial_ports = kcalloc(brd->nasync, sizeof(*brd->serial_ports), brd->serial_ports = kcalloc(brd->nasync, sizeof(*brd->serial_ports),
GFP_KERNEL); GFP_KERNEL);
if (brd->serial_ports == NULL) if (!brd->serial_ports)
return -ENOMEM; return -ENOMEM;
brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports), brd->printer_ports = kcalloc(brd->nasync, sizeof(*brd->printer_ports),
GFP_KERNEL); GFP_KERNEL);
if (brd->printer_ports == NULL) if (!brd->printer_ports)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < brd->nasync; i++) { for (i = 0; i < brd->nasync; i++) {
...@@ -6524,7 +6524,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6524,7 +6524,7 @@ static int dgap_parsefile(char **in, int remove)
return -1; return -1;
} }
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6542,7 +6542,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6542,7 +6542,7 @@ static int dgap_parsefile(char **in, int remove)
return -1; return -1;
} }
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6560,7 +6560,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6560,7 +6560,7 @@ static int dgap_parsefile(char **in, int remove)
return -1; return -1;
} }
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6571,7 +6571,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6571,7 +6571,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p->u.board.v_pcibus = 1; p->u.board.v_pcibus = 1;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6589,7 +6589,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6589,7 +6589,7 @@ static int dgap_parsefile(char **in, int remove)
return -1; return -1;
} }
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6603,7 +6603,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6603,7 +6603,7 @@ static int dgap_parsefile(char **in, int remove)
return -1; return -1;
} }
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6613,7 +6613,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6613,7 +6613,7 @@ static int dgap_parsefile(char **in, int remove)
case NPORTS: /* number of ports */ case NPORTS: /* number of ports */
if (p->type == BNODE) { if (p->type == BNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6624,7 +6624,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6624,7 +6624,7 @@ static int dgap_parsefile(char **in, int remove)
p->u.board.v_nport = 1; p->u.board.v_nport = 1;
} else if (p->type == CNODE) { } else if (p->type == CNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6635,7 +6635,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6635,7 +6635,7 @@ static int dgap_parsefile(char **in, int remove)
p->u.conc.v_nport = 1; p->u.conc.v_nport = 1;
} else if (p->type == MNODE) { } else if (p->type == MNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6652,7 +6652,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6652,7 +6652,7 @@ static int dgap_parsefile(char **in, int remove)
case ID: /* letter ID used in tty name */ case ID: /* letter ID used in tty name */
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6674,7 +6674,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6674,7 +6674,7 @@ static int dgap_parsefile(char **in, int remove)
case STARTO: /* start offset of ID */ case STARTO: /* start offset of ID */
if (p->type == BNODE) { if (p->type == BNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6685,7 +6685,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6685,7 +6685,7 @@ static int dgap_parsefile(char **in, int remove)
p->u.board.v_start = 1; p->u.board.v_start = 1;
} else if (p->type == CNODE) { } else if (p->type == CNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6696,7 +6696,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6696,7 +6696,7 @@ static int dgap_parsefile(char **in, int remove)
p->u.conc.v_start = 1; p->u.conc.v_start = 1;
} else if (p->type == MNODE) { } else if (p->type == MNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6756,7 +6756,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6756,7 +6756,7 @@ static int dgap_parsefile(char **in, int remove)
case LINE: /* line information */ case LINE: /* line information */
if (dgap_checknode(p)) if (dgap_checknode(p))
return -1; return -1;
if (brd == NULL) { if (!brd) {
dgap_err("must specify board before line info"); dgap_err("must specify board before line info");
return -1; return -1;
} }
...@@ -6779,7 +6779,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6779,7 +6779,7 @@ static int dgap_parsefile(char **in, int remove)
case CONC: /* concentrator information */ case CONC: /* concentrator information */
if (dgap_checknode(p)) if (dgap_checknode(p))
return -1; return -1;
if (line == NULL) { if (!line) {
dgap_err("must specify line info before concentrator"); dgap_err("must specify line info before concentrator");
return -1; return -1;
} }
...@@ -6818,7 +6818,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6818,7 +6818,7 @@ static int dgap_parsefile(char **in, int remove)
case MOD: /* EBI module */ case MOD: /* EBI module */
if (dgap_checknode(p)) if (dgap_checknode(p))
return -1; return -1;
if (brd == NULL) { if (!brd) {
dgap_err("must specify board info before EBI modules"); dgap_err("must specify board info before EBI modules");
return -1; return -1;
} }
...@@ -6827,7 +6827,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6827,7 +6827,7 @@ static int dgap_parsefile(char **in, int remove)
linecnt = 0; linecnt = 0;
break; break;
default: default:
if (conc == NULL) { if (!conc) {
dgap_err("must specify concentrator info before EBI module"); dgap_err("must specify concentrator info before EBI module");
return -1; return -1;
} }
...@@ -6878,7 +6878,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6878,7 +6878,7 @@ static int dgap_parsefile(char **in, int remove)
case SPEED: /* sync line speed indication */ case SPEED: /* sync line speed indication */
if (p->type == LNODE) { if (p->type == LNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6889,7 +6889,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6889,7 +6889,7 @@ static int dgap_parsefile(char **in, int remove)
p->u.line.v_speed = 1; p->u.line.v_speed = 1;
} else if (p->type == CNODE) { } else if (p->type == CNODE) {
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6946,7 +6946,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6946,7 +6946,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6966,7 +6966,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6966,7 +6966,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -6986,7 +6986,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -6986,7 +6986,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -7006,7 +7006,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -7006,7 +7006,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -7026,7 +7026,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -7026,7 +7026,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -7046,7 +7046,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -7046,7 +7046,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -7066,7 +7066,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -7066,7 +7066,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -7086,7 +7086,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -7086,7 +7086,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
...@@ -7106,7 +7106,7 @@ static int dgap_parsefile(char **in, int remove) ...@@ -7106,7 +7106,7 @@ static int dgap_parsefile(char **in, int remove)
} }
p = p->next; p = p->next;
s = dgap_getword(in); s = dgap_getword(in);
if (s == NULL) { if (!s) {
dgap_err("unexpected end of file"); dgap_err("unexpected end of file");
return -1; return -1;
} }
......
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