diff options
author | Alan Cox <alan@redhat.com> | 2008-10-13 05:44:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-13 12:51:44 -0400 |
commit | 51383f69ec56fe3f425d5255fb43e18c445e061c (patch) | |
tree | f9d9e280892702c3a47ffa807c0937ea9c80e315 /drivers/char/stallion.c | |
parent | ea1afd256258f04a290aaa7fd5c2d4deb2e79e26 (diff) |
tty: Remove lots of NULL checks
Many tty drivers contain 'can't happen' checks against NULL pointers passed
in by the tty layer. These have never been possible to occur. Even more
importantly if they ever do occur we want to know as it would be a serious
bug.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/stallion.c')
-rw-r--r-- | drivers/char/stallion.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 81b3234127db..8b8f07a7f505 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -849,8 +849,6 @@ static void stl_flushbuffer(struct tty_struct *tty) | |||
849 | 849 | ||
850 | pr_debug("stl_flushbuffer(tty=%p)\n", tty); | 850 | pr_debug("stl_flushbuffer(tty=%p)\n", tty); |
851 | 851 | ||
852 | if (tty == NULL) | ||
853 | return; | ||
854 | portp = tty->driver_data; | 852 | portp = tty->driver_data; |
855 | if (portp == NULL) | 853 | if (portp == NULL) |
856 | return; | 854 | return; |
@@ -868,8 +866,6 @@ static void stl_waituntilsent(struct tty_struct *tty, int timeout) | |||
868 | 866 | ||
869 | pr_debug("stl_waituntilsent(tty=%p,timeout=%d)\n", tty, timeout); | 867 | pr_debug("stl_waituntilsent(tty=%p,timeout=%d)\n", tty, timeout); |
870 | 868 | ||
871 | if (tty == NULL) | ||
872 | return; | ||
873 | portp = tty->driver_data; | 869 | portp = tty->driver_data; |
874 | if (portp == NULL) | 870 | if (portp == NULL) |
875 | return; | 871 | return; |
@@ -1036,8 +1032,6 @@ static int stl_putchar(struct tty_struct *tty, unsigned char ch) | |||
1036 | 1032 | ||
1037 | pr_debug("stl_putchar(tty=%p,ch=%x)\n", tty, ch); | 1033 | pr_debug("stl_putchar(tty=%p,ch=%x)\n", tty, ch); |
1038 | 1034 | ||
1039 | if (tty == NULL) | ||
1040 | return -EINVAL; | ||
1041 | portp = tty->driver_data; | 1035 | portp = tty->driver_data; |
1042 | if (portp == NULL) | 1036 | if (portp == NULL) |
1043 | return -EINVAL; | 1037 | return -EINVAL; |
@@ -1073,8 +1067,6 @@ static void stl_flushchars(struct tty_struct *tty) | |||
1073 | 1067 | ||
1074 | pr_debug("stl_flushchars(tty=%p)\n", tty); | 1068 | pr_debug("stl_flushchars(tty=%p)\n", tty); |
1075 | 1069 | ||
1076 | if (tty == NULL) | ||
1077 | return; | ||
1078 | portp = tty->driver_data; | 1070 | portp = tty->driver_data; |
1079 | if (portp == NULL) | 1071 | if (portp == NULL) |
1080 | return; | 1072 | return; |
@@ -1093,8 +1085,6 @@ static int stl_writeroom(struct tty_struct *tty) | |||
1093 | 1085 | ||
1094 | pr_debug("stl_writeroom(tty=%p)\n", tty); | 1086 | pr_debug("stl_writeroom(tty=%p)\n", tty); |
1095 | 1087 | ||
1096 | if (tty == NULL) | ||
1097 | return 0; | ||
1098 | portp = tty->driver_data; | 1088 | portp = tty->driver_data; |
1099 | if (portp == NULL) | 1089 | if (portp == NULL) |
1100 | return 0; | 1090 | return 0; |
@@ -1125,8 +1115,6 @@ static int stl_charsinbuffer(struct tty_struct *tty) | |||
1125 | 1115 | ||
1126 | pr_debug("stl_charsinbuffer(tty=%p)\n", tty); | 1116 | pr_debug("stl_charsinbuffer(tty=%p)\n", tty); |
1127 | 1117 | ||
1128 | if (tty == NULL) | ||
1129 | return 0; | ||
1130 | portp = tty->driver_data; | 1118 | portp = tty->driver_data; |
1131 | if (portp == NULL) | 1119 | if (portp == NULL) |
1132 | return 0; | 1120 | return 0; |
@@ -1219,8 +1207,6 @@ static int stl_tiocmget(struct tty_struct *tty, struct file *file) | |||
1219 | { | 1207 | { |
1220 | struct stlport *portp; | 1208 | struct stlport *portp; |
1221 | 1209 | ||
1222 | if (tty == NULL) | ||
1223 | return -ENODEV; | ||
1224 | portp = tty->driver_data; | 1210 | portp = tty->driver_data; |
1225 | if (portp == NULL) | 1211 | if (portp == NULL) |
1226 | return -ENODEV; | 1212 | return -ENODEV; |
@@ -1236,8 +1222,6 @@ static int stl_tiocmset(struct tty_struct *tty, struct file *file, | |||
1236 | struct stlport *portp; | 1222 | struct stlport *portp; |
1237 | int rts = -1, dtr = -1; | 1223 | int rts = -1, dtr = -1; |
1238 | 1224 | ||
1239 | if (tty == NULL) | ||
1240 | return -ENODEV; | ||
1241 | portp = tty->driver_data; | 1225 | portp = tty->driver_data; |
1242 | if (portp == NULL) | 1226 | if (portp == NULL) |
1243 | return -ENODEV; | 1227 | return -ENODEV; |
@@ -1266,8 +1250,6 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd | |||
1266 | pr_debug("stl_ioctl(tty=%p,file=%p,cmd=%x,arg=%lx)\n", tty, file, cmd, | 1250 | pr_debug("stl_ioctl(tty=%p,file=%p,cmd=%x,arg=%lx)\n", tty, file, cmd, |
1267 | arg); | 1251 | arg); |
1268 | 1252 | ||
1269 | if (tty == NULL) | ||
1270 | return -ENODEV; | ||
1271 | portp = tty->driver_data; | 1253 | portp = tty->driver_data; |
1272 | if (portp == NULL) | 1254 | if (portp == NULL) |
1273 | return -ENODEV; | 1255 | return -ENODEV; |
@@ -1321,8 +1303,6 @@ static void stl_start(struct tty_struct *tty) | |||
1321 | 1303 | ||
1322 | pr_debug("stl_start(tty=%p)\n", tty); | 1304 | pr_debug("stl_start(tty=%p)\n", tty); |
1323 | 1305 | ||
1324 | if (tty == NULL) | ||
1325 | return; | ||
1326 | portp = tty->driver_data; | 1306 | portp = tty->driver_data; |
1327 | if (portp == NULL) | 1307 | if (portp == NULL) |
1328 | return; | 1308 | return; |
@@ -1338,8 +1318,6 @@ static void stl_settermios(struct tty_struct *tty, struct ktermios *old) | |||
1338 | 1318 | ||
1339 | pr_debug("stl_settermios(tty=%p,old=%p)\n", tty, old); | 1319 | pr_debug("stl_settermios(tty=%p,old=%p)\n", tty, old); |
1340 | 1320 | ||
1341 | if (tty == NULL) | ||
1342 | return; | ||
1343 | portp = tty->driver_data; | 1321 | portp = tty->driver_data; |
1344 | if (portp == NULL) | 1322 | if (portp == NULL) |
1345 | return; | 1323 | return; |
@@ -1373,8 +1351,6 @@ static void stl_throttle(struct tty_struct *tty) | |||
1373 | 1351 | ||
1374 | pr_debug("stl_throttle(tty=%p)\n", tty); | 1352 | pr_debug("stl_throttle(tty=%p)\n", tty); |
1375 | 1353 | ||
1376 | if (tty == NULL) | ||
1377 | return; | ||
1378 | portp = tty->driver_data; | 1354 | portp = tty->driver_data; |
1379 | if (portp == NULL) | 1355 | if (portp == NULL) |
1380 | return; | 1356 | return; |
@@ -1393,8 +1369,6 @@ static void stl_unthrottle(struct tty_struct *tty) | |||
1393 | 1369 | ||
1394 | pr_debug("stl_unthrottle(tty=%p)\n", tty); | 1370 | pr_debug("stl_unthrottle(tty=%p)\n", tty); |
1395 | 1371 | ||
1396 | if (tty == NULL) | ||
1397 | return; | ||
1398 | portp = tty->driver_data; | 1372 | portp = tty->driver_data; |
1399 | if (portp == NULL) | 1373 | if (portp == NULL) |
1400 | return; | 1374 | return; |
@@ -1414,8 +1388,6 @@ static void stl_stop(struct tty_struct *tty) | |||
1414 | 1388 | ||
1415 | pr_debug("stl_stop(tty=%p)\n", tty); | 1389 | pr_debug("stl_stop(tty=%p)\n", tty); |
1416 | 1390 | ||
1417 | if (tty == NULL) | ||
1418 | return; | ||
1419 | portp = tty->driver_data; | 1391 | portp = tty->driver_data; |
1420 | if (portp == NULL) | 1392 | if (portp == NULL) |
1421 | return; | 1393 | return; |
@@ -1436,8 +1408,6 @@ static void stl_hangup(struct tty_struct *tty) | |||
1436 | 1408 | ||
1437 | pr_debug("stl_hangup(tty=%p)\n", tty); | 1409 | pr_debug("stl_hangup(tty=%p)\n", tty); |
1438 | 1410 | ||
1439 | if (tty == NULL) | ||
1440 | return; | ||
1441 | portp = tty->driver_data; | 1411 | portp = tty->driver_data; |
1442 | if (portp == NULL) | 1412 | if (portp == NULL) |
1443 | return; | 1413 | return; |
@@ -1470,8 +1440,6 @@ static int stl_breakctl(struct tty_struct *tty, int state) | |||
1470 | 1440 | ||
1471 | pr_debug("stl_breakctl(tty=%p,state=%d)\n", tty, state); | 1441 | pr_debug("stl_breakctl(tty=%p,state=%d)\n", tty, state); |
1472 | 1442 | ||
1473 | if (tty == NULL) | ||
1474 | return -EINVAL; | ||
1475 | portp = tty->driver_data; | 1443 | portp = tty->driver_data; |
1476 | if (portp == NULL) | 1444 | if (portp == NULL) |
1477 | return -EINVAL; | 1445 | return -EINVAL; |
@@ -1488,8 +1456,6 @@ static void stl_sendxchar(struct tty_struct *tty, char ch) | |||
1488 | 1456 | ||
1489 | pr_debug("stl_sendxchar(tty=%p,ch=%x)\n", tty, ch); | 1457 | pr_debug("stl_sendxchar(tty=%p,ch=%x)\n", tty, ch); |
1490 | 1458 | ||
1491 | if (tty == NULL) | ||
1492 | return; | ||
1493 | portp = tty->driver_data; | 1459 | portp = tty->driver_data; |
1494 | if (portp == NULL) | 1460 | if (portp == NULL) |
1495 | return; | 1461 | return; |