netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <w.sang@pengutronix.de>
To: netdev@vger.kernel.org
Cc: Wolfram Sang <w.sang@pengutronix.de>,
	Samuel Ortiz <sameo@linux.intel.com>,
	David Miller <davem@davemloft.net>
Subject: [PATCH] net: irda: irttp: sync error paths of data- and udata-requests
Date: Tue, 16 Nov 2010 20:40:02 +0100	[thread overview]
Message-ID: <1289936402-25277-1-git-send-email-w.sang@pengutronix.de> (raw)
In-Reply-To: <20101116.095101.115945762.davem@davemloft.net>

irttp_data_request() returns meaningful errorcodes, while irttp_udata_request()
just returns -1 in similar situations. Sync the two and the loglevels of the
accompanying output.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: David Miller <davem@davemloft.net>
---

Thank you David for picking up the zero-byte-packet-patch. Now as it was
applied, this one might be interesting, too (on top of it)? Nothing seriously
needed, but looks more proper IMHO. LXR says that are callers of these
functions check with < 0 anyhow.

 net/irda/irttp.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 6cfaeaf..f6054f9 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -550,7 +550,7 @@ EXPORT_SYMBOL(irttp_close_tsap);
  */
 int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb)
 {
-	int ret = -1;
+	int ret;
 
 	IRDA_ASSERT(self != NULL, return -1;);
 	IRDA_ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
@@ -566,13 +566,14 @@ int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb)
 
 	/* Check that nothing bad happens */
 	if (!self->connected) {
-		IRDA_DEBUG(1, "%s(), Not connected\n", __func__);
+		IRDA_WARNING("%s(), Not connected\n", __func__);
+		ret = -ENOTCONN;
 		goto err;
 	}
 
 	if (skb->len > self->max_seg_size) {
-		IRDA_DEBUG(1, "%s(), UData is too large for IrLAP!\n",
-			   __func__);
+		IRDA_ERROR("%s(), UData is too large for IrLAP!\n", __func__);
+		ret = -EMSGSIZE;
 		goto err;
 	}
 
-- 
1.7.2.3


  reply	other threads:[~2010-11-16 19:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 23:19 [RFC] irda: irttp: allow zero byte packets Wolfram Sang
2010-11-16 17:51 ` David Miller
2010-11-16 19:40   ` Wolfram Sang [this message]
2010-11-18 20:24     ` [PATCH] net: irda: irttp: sync error paths of data- and udata-requests 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=1289936402-25277-1-git-send-email-w.sang@pengutronix.de \
    --to=w.sang@pengutronix.de \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /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).