aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda
diff options
context:
space:
mode:
authorSamuel Ortiz <samuel@ortiz.org>2007-04-21 01:10:13 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:29:30 -0400
commitc3ea9fa2741320f9cade15efe10559b549af4ebf (patch)
treefa20974812a9ea41a80e2090df82d26fefaa8cb5 /net/irda
parentd7f48d1a9398a3bd7bb6f4774640b24a0294cda3 (diff)
[IrDA] af_irda: IRDA_ASSERT cleanups
In af_irda.c, the multiple IRDA_ASSERT() are either hiding bugs, useless, or returning the wrong value. Let's clean that up. Signed-off-by: Samuel Ortiz <samuel@sortiz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda')
-rw-r--r--net/irda/af_irda.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c
index 4eda10d79141..06c97c60d542 100644
--- a/net/irda/af_irda.c
+++ b/net/irda/af_irda.c
@@ -89,7 +89,6 @@ static int irda_data_indication(void *instance, void *sap, struct sk_buff *skb)
89 89
90 self = instance; 90 self = instance;
91 sk = instance; 91 sk = instance;
92 IRDA_ASSERT(sk != NULL, return -1;);
93 92
94 err = sock_queue_rcv_skb(sk, skb); 93 err = sock_queue_rcv_skb(sk, skb);
95 if (err) { 94 if (err) {
@@ -305,8 +304,6 @@ static void irda_connect_response(struct irda_sock *self)
305 304
306 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 305 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
307 306
308 IRDA_ASSERT(self != NULL, return;);
309
310 skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, 307 skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
311 GFP_ATOMIC); 308 GFP_ATOMIC);
312 if (skb == NULL) { 309 if (skb == NULL) {
@@ -336,7 +333,7 @@ static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
336 333
337 self = instance; 334 self = instance;
338 sk = instance; 335 sk = instance;
339 IRDA_ASSERT(sk != NULL, return;); 336 BUG_ON(sk == NULL);
340 337
341 switch (flow) { 338 switch (flow) {
342 case FLOW_STOP: 339 case FLOW_STOP:
@@ -448,7 +445,7 @@ static void irda_discovery_timeout(u_long priv)
448 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 445 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
449 446
450 self = (struct irda_sock *) priv; 447 self = (struct irda_sock *) priv;
451 IRDA_ASSERT(self != NULL, return;); 448 BUG_ON(self == NULL);
452 449
453 /* Nothing for the caller */ 450 /* Nothing for the caller */
454 self->cachelog = NULL; 451 self->cachelog = NULL;
@@ -545,8 +542,6 @@ static int irda_find_lsap_sel(struct irda_sock *self, char *name)
545{ 542{
546 IRDA_DEBUG(2, "%s(%p, %s)\n", __FUNCTION__, self, name); 543 IRDA_DEBUG(2, "%s(%p, %s)\n", __FUNCTION__, self, name);
547 544
548 IRDA_ASSERT(self != NULL, return -1;);
549
550 if (self->iriap) { 545 if (self->iriap) {
551 IRDA_WARNING("%s(): busy with a previous query\n", 546 IRDA_WARNING("%s(): busy with a previous query\n",
552 __FUNCTION__); 547 __FUNCTION__);
@@ -634,8 +629,6 @@ static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name)
634 629
635 IRDA_DEBUG(2, "%s(), name=%s\n", __FUNCTION__, name); 630 IRDA_DEBUG(2, "%s(), name=%s\n", __FUNCTION__, name);
636 631
637 IRDA_ASSERT(self != NULL, return -1;);
638
639 /* Ask lmp for the current discovery log 632 /* Ask lmp for the current discovery log
640 * Note : we have to use irlmp_get_discoveries(), as opposed 633 * Note : we have to use irlmp_get_discoveries(), as opposed
641 * to play with the cachelog directly, because while we are 634 * to play with the cachelog directly, because while we are
@@ -783,8 +776,6 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
783 struct irda_sock *self = irda_sk(sk); 776 struct irda_sock *self = irda_sk(sk);
784 int err; 777 int err;
785 778
786 IRDA_ASSERT(self != NULL, return -1;);
787
788 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); 779 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
789 780
790 if (addr_len != sizeof(struct sockaddr_irda)) 781 if (addr_len != sizeof(struct sockaddr_irda))
@@ -840,8 +831,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
840 831
841 IRDA_DEBUG(2, "%s()\n", __FUNCTION__); 832 IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
842 833
843 IRDA_ASSERT(self != NULL, return -1;);
844
845 err = irda_create(newsock, sk->sk_protocol); 834 err = irda_create(newsock, sk->sk_protocol);
846 if (err) 835 if (err)
847 return err; 836 return err;
@@ -888,10 +877,12 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags)
888 } 877 }
889 878
890 newsk = newsock->sk; 879 newsk = newsock->sk;
880 if (newsk == NULL)
881 return -EIO;
882
891 newsk->sk_state = TCP_ESTABLISHED; 883 newsk->sk_state = TCP_ESTABLISHED;
892 884
893 new = irda_sk(newsk); 885 new = irda_sk(newsk);
894 IRDA_ASSERT(new != NULL, return -1;);
895 886
896 /* Now attach up the new socket */ 887 /* Now attach up the new socket */
897 new->tsap = irttp_dup(self->tsap, new); 888 new->tsap = irttp_dup(self->tsap, new);
@@ -1153,8 +1144,6 @@ static void irda_destroy_socket(struct irda_sock *self)
1153{ 1144{
1154 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); 1145 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
1155 1146
1156 IRDA_ASSERT(self != NULL, return;);
1157
1158 /* Unregister with IrLMP */ 1147 /* Unregister with IrLMP */
1159 irlmp_unregister_client(self->ckey); 1148 irlmp_unregister_client(self->ckey);
1160 irlmp_unregister_service(self->skey); 1149 irlmp_unregister_service(self->skey);
@@ -1273,7 +1262,6 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
1273 return -ENOTCONN; 1262 return -ENOTCONN;
1274 1263
1275 self = irda_sk(sk); 1264 self = irda_sk(sk);
1276 IRDA_ASSERT(self != NULL, return -1;);
1277 1265
1278 /* Check if IrTTP is wants us to slow down */ 1266 /* Check if IrTTP is wants us to slow down */
1279 1267
@@ -1336,8 +1324,6 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,
1336 1324
1337 IRDA_DEBUG(4, "%s()\n", __FUNCTION__); 1325 IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
1338 1326
1339 IRDA_ASSERT(self != NULL, return -1;);
1340
1341 if ((err = sock_error(sk)) < 0) 1327 if ((err = sock_error(sk)) < 0)
1342 return err; 1328 return err;
1343 1329
@@ -1391,8 +1377,6 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock,
1391 1377
1392 IRDA_DEBUG(3, "%s()\n", __FUNCTION__); 1378 IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
1393 1379
1394 IRDA_ASSERT(self != NULL, return -1;);
1395
1396 if ((err = sock_error(sk)) < 0) 1380 if ((err = sock_error(sk)) < 0)
1397 return err; 1381 return err;
1398 1382
@@ -1526,7 +1510,6 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
1526 return -ENOTCONN; 1510 return -ENOTCONN;
1527 1511
1528 self = irda_sk(sk); 1512 self = irda_sk(sk);
1529 IRDA_ASSERT(self != NULL, return -1;);
1530 1513
1531 /* 1514 /*
1532 * Check that we don't send out too big frames. This is an unreliable 1515 * Check that we don't send out too big frames. This is an unreliable
@@ -1595,7 +1578,6 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
1595 } 1578 }
1596 1579
1597 self = irda_sk(sk); 1580 self = irda_sk(sk);
1598 IRDA_ASSERT(self != NULL, return -1;);
1599 1581
1600 /* Check if an address was specified with sendto. Jean II */ 1582 /* Check if an address was specified with sendto. Jean II */
1601 if (msg->msg_name) { 1583 if (msg->msg_name) {
@@ -1669,8 +1651,6 @@ static int irda_shutdown(struct socket *sock, int how)
1669 struct sock *sk = sock->sk; 1651 struct sock *sk = sock->sk;
1670 struct irda_sock *self = irda_sk(sk); 1652 struct irda_sock *self = irda_sk(sk);
1671 1653
1672 IRDA_ASSERT(self != NULL, return -1;);
1673
1674 IRDA_DEBUG(1, "%s(%p)\n", __FUNCTION__, self); 1654 IRDA_DEBUG(1, "%s(%p)\n", __FUNCTION__, self);
1675 1655
1676 sk->sk_state = TCP_CLOSE; 1656 sk->sk_state = TCP_CLOSE;
@@ -1843,8 +1823,6 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1843 struct ias_attrib * ias_attr; /* Attribute in IAS object */ 1823 struct ias_attrib * ias_attr; /* Attribute in IAS object */
1844 int opt; 1824 int opt;
1845 1825
1846 IRDA_ASSERT(self != NULL, return -1;);
1847
1848 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); 1826 IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
1849 1827
1850 if (level != SOL_IRLMP) 1828 if (level != SOL_IRLMP)