From: Julia Lawall <julia@diku.dk>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>,
linux1394-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 1/16] drivers/firewire: Use available error codes
Date: Mon, 16 Aug 2010 18:24:41 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.64.1008161824210.19313@ask.diku.dk> (raw)
From: Julia Lawall <julia@diku.dk>
Error codes are stored in retval, but the return value is always 0. Return
retval in the error case instead.
The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
local idexpression x;
constant C;
@@
if (...) { ...
x = -C
... when != x
(
return <+...x...+>;
|
return NULL;
|
return;
|
* return ...;
)
}
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
This changes the semantics of the code and has not been tested.
Furthermore, there is another call, to fwnet_pd_update, where there is a
goto to bad_proto (the label associated with the second block of code), and
that does not set retval. Perhaps a value should be chosen in that case.
Or perhaps retval should just be dropped, if it is not going to be used.
drivers/firewire/net.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index da17d40..8d91484 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -681,7 +681,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
int fg_off;
int dg_size;
u16 datagram_label;
- int retval;
+ int retval = 0;
u16 ether_type;
hdr.w0 = be32_to_cpu(buf[0]);
@@ -801,7 +801,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
if (netif_queue_stopped(net))
netif_wake_queue(net);
- return 0;
+ return retval;
}
static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r,
next reply other threads:[~2010-08-16 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 16:24 Julia Lawall [this message]
2010-08-16 21:45 ` Stefan Richter
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=Pine.LNX.4.64.1008161824210.19313@ask.diku.dk \
--to=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=stefanr@s5r6.in-berlin.de \
/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
all inboxes | Powered by JetHome®