From: samuel-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org
To: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [PATCH 4/7] [IrDA] af_irda: IRDA_ASSERT cleanups
Date: Thu, 19 Apr 2007 00:32:06 +0300 [thread overview]
Message-ID: <20070418214751.145259810@sortiz.org> (raw)
In-Reply-To: 20070418213202.214829666@sortiz.org
[-- Attachment #1: 0005-IrDA-net-2.6.22-af_irda-IRDA_ASSERT-cleanups.patch --]
[-- Type: text/plain, Size: 4293 bytes --]
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-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
---
net/irda/af_irda.c | 32 +++++---------------------------
1 files changed, 5 insertions(+), 27 deletions(-)
Index: net-2.6.22-quilt/net/irda/af_irda.c
===================================================================
--- net-2.6.22-quilt.orig/net/irda/af_irda.c 2007-04-18 02:16:43.000000000 +0300
+++ net-2.6.22-quilt/net/irda/af_irda.c 2007-04-18 02:16:43.000000000 +0300
@@ -89,7 +89,6 @@
self = instance;
sk = instance;
- IRDA_ASSERT(sk != NULL, return -1;);
err = sock_queue_rcv_skb(sk, skb);
if (err) {
@@ -306,8 +305,6 @@
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
- IRDA_ASSERT(self != NULL, return;);
-
skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER,
GFP_ATOMIC);
if (skb == NULL) {
@@ -337,7 +334,7 @@
self = instance;
sk = instance;
- IRDA_ASSERT(sk != NULL, return;);
+ BUG_ON(sk == NULL);
switch (flow) {
case FLOW_STOP:
@@ -449,7 +446,7 @@
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
self = (struct irda_sock *) priv;
- IRDA_ASSERT(self != NULL, return;);
+ BUG_ON(self == NULL);
/* Nothing for the caller */
self->cachelog = NULL;
@@ -546,8 +543,6 @@
{
IRDA_DEBUG(2, "%s(%p, %s)\n", __FUNCTION__, self, name);
- IRDA_ASSERT(self != NULL, return -1;);
-
if (self->iriap) {
IRDA_WARNING("%s(): busy with a previous query\n",
__FUNCTION__);
@@ -635,8 +630,6 @@
IRDA_DEBUG(2, "%s(), name=%s\n", __FUNCTION__, name);
- IRDA_ASSERT(self != NULL, return -1;);
-
/* Ask lmp for the current discovery log
* Note : we have to use irlmp_get_discoveries(), as opposed
* to play with the cachelog directly, because while we are
@@ -784,8 +777,6 @@
struct irda_sock *self = irda_sk(sk);
int err;
- IRDA_ASSERT(self != NULL, return -1;);
-
IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
if (addr_len != sizeof(struct sockaddr_irda))
@@ -841,8 +832,6 @@
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
- IRDA_ASSERT(self != NULL, return -1;);
-
err = irda_create(newsock, sk->sk_protocol);
if (err)
return err;
@@ -889,10 +878,12 @@
}
newsk = newsock->sk;
+ if (newsk == NULL)
+ return -EIO;
+
newsk->sk_state = TCP_ESTABLISHED;
new = irda_sk(newsk);
- IRDA_ASSERT(new != NULL, return -1;);
/* Now attach up the new socket */
new->tsap = irttp_dup(self->tsap, new);
@@ -1154,8 +1145,6 @@
{
IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
- IRDA_ASSERT(self != NULL, return;);
-
/* Unregister with IrLMP */
irlmp_unregister_client(self->ckey);
irlmp_unregister_service(self->skey);
@@ -1274,7 +1263,6 @@
return -ENOTCONN;
self = irda_sk(sk);
- IRDA_ASSERT(self != NULL, return -1;);
/* Check if IrTTP is wants us to slow down */
@@ -1337,8 +1325,6 @@
IRDA_DEBUG(4, "%s()\n", __FUNCTION__);
- IRDA_ASSERT(self != NULL, return -1;);
-
if ((err = sock_error(sk)) < 0)
return err;
@@ -1392,8 +1378,6 @@
IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
- IRDA_ASSERT(self != NULL, return -1;);
-
if ((err = sock_error(sk)) < 0)
return err;
@@ -1527,7 +1511,6 @@
return -ENOTCONN;
self = irda_sk(sk);
- IRDA_ASSERT(self != NULL, return -1;);
/*
* Check that we don't send out too big frames. This is an unreliable
@@ -1596,7 +1579,6 @@
}
self = irda_sk(sk);
- IRDA_ASSERT(self != NULL, return -1;);
/* Check if an address was specified with sendto. Jean II */
if (msg->msg_name) {
@@ -1670,8 +1652,6 @@
struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk);
- IRDA_ASSERT(self != NULL, return -1;);
-
IRDA_DEBUG(1, "%s(%p)\n", __FUNCTION__, self);
sk->sk_state = TCP_CLOSE;
@@ -1844,8 +1824,6 @@
struct ias_attrib * ias_attr; /* Attribute in IAS object */
int opt;
- IRDA_ASSERT(self != NULL, return -1;);
-
IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);
if (level != SOL_IRLMP)
--
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
next prev parent reply other threads:[~2007-04-18 21:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-18 21:32 [PATCH 0/7] [IrDA] net-2.6.22 fixes samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-18 21:32 ` [PATCH 1/7] [IrDA] af_irda: irda_recvmsg_stream cleanup samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:05 ` David Miller
2007-04-18 21:32 ` [PATCH 2/7] [IrDA] af_irda: Silence kernel message in irda_recvmsg_stream samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:09 ` David Miller
[not found] ` <20070420.220900.45154094.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-04-21 12:01 ` Samuel Ortiz
[not found] ` <20070421120152.GB4337-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-04-21 17:43 ` David Miller
2007-04-18 21:32 ` [PATCH 3/7] [IrDA] af_irda: irda_accept cleanup samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:09 ` David Miller
2007-04-18 21:32 ` samuel-jcdQHdrhKHMdnm+yROfE0A [this message]
2007-04-21 5:10 ` [PATCH 4/7] [IrDA] af_irda: IRDA_ASSERT cleanups David Miller
2007-04-18 21:32 ` [PATCH 5/7] [IrDA] IrDA monitor mode samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:11 ` David Miller
[not found] ` <20070420.221143.132446079.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-04-21 11:42 ` Samuel Ortiz
[not found] ` <20070421114239.GA4337-jcdQHdrhKHMdnm+yROfE0A@public.gmane.org>
2007-04-21 17:46 ` David Miller
2007-04-22 11:29 ` [irda-users] " Samuel Ortiz
2007-04-22 19:59 ` David Miller
2007-04-18 21:32 ` [PATCH 6/7] [IrDA] Adding carriage returns to mcs7780 debug statements samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:12 ` David Miller
2007-04-18 21:32 ` [PATCH 7/7] [IrDA] Misc spelling corrections samuel-jcdQHdrhKHMdnm+yROfE0A
2007-04-21 5:13 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070418214751.145259810@sortiz.org \
--to=samuel-jcdqhdrhkhmdnm+yrofe0a@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=irda-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).