* [PATCH 3/8] net/9p/trans_fd.c: Fix unsigned return type
[not found] <1283713226-8429-1-git-send-email-julia@diku.dk>
@ 2010-09-05 19:00 ` Julia Lawall
2010-09-07 1:39 ` David Miller
2010-09-05 19:00 ` [PATCH 5/8] drivers/atm/firestream.c: " Julia Lawall
2010-09-05 19:00 ` [PATCH 8/8] drivers/net/wireless/iwlwifi/iwl-agn.c: Fix return value from an unsigned function Julia Lawall
2 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2010-09-05 19:00 UTC (permalink / raw)
To: David S. Miller; +Cc: kernel-janitors, netdev, linux-kernel
The function has an unsigned return type, but returns a negative constant
to indicate an error condition. The result of calling the function is
always stored in a variable of type (signed) int, and thus unsigned can be
dropped from the return type.
A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@exists@
identifier f;
constant C;
@@
unsigned f(...)
{ <+...
* return -C;
...+> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
net/9p/trans_fd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index c85109d..078eb16 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -222,7 +222,7 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
}
}
-static unsigned int
+static int
p9_fd_poll(struct p9_client *client, struct poll_table_struct *pt)
{
int ret, n;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/8] drivers/atm/firestream.c: Fix unsigned return type
[not found] <1283713226-8429-1-git-send-email-julia@diku.dk>
2010-09-05 19:00 ` [PATCH 3/8] net/9p/trans_fd.c: Fix unsigned return type Julia Lawall
@ 2010-09-05 19:00 ` Julia Lawall
2010-09-07 1:40 ` David Miller
2010-09-05 19:00 ` [PATCH 8/8] drivers/net/wireless/iwlwifi/iwl-agn.c: Fix return value from an unsigned function Julia Lawall
2 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2010-09-05 19:00 UTC (permalink / raw)
To: Chas Williams; +Cc: kernel-janitors, linux-atm-general, netdev, linux-kernel
The function has an unsigned return type, but returns a negative constant
to indicate an error condition. The result of calling the function is
always stored in a variable of type (signed) int, and thus unsigned can be
dropped from the return type.
A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@exists@
identifier f;
constant C;
@@
unsigned f(...)
{ <+...
* return -C;
...+> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/atm/firestream.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 8717809..1af977e 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -444,8 +444,8 @@ static inline void fs_kfree_skb (struct sk_buff * skb)
#define ROUND_NEAREST 3
/********** make rate (not quite as much fun as Horizon) **********/
-static unsigned int make_rate (unsigned int rate, int r,
- u16 * bits, unsigned int * actual)
+static int make_rate(unsigned int rate, int r,
+ u16 *bits, unsigned int *actual)
{
unsigned char exp = -1; /* hush gcc */
unsigned int man = -1; /* hush gcc */
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 8/8] drivers/net/wireless/iwlwifi/iwl-agn.c: Fix return value from an unsigned function
[not found] <1283713226-8429-1-git-send-email-julia@diku.dk>
2010-09-05 19:00 ` [PATCH 3/8] net/9p/trans_fd.c: Fix unsigned return type Julia Lawall
2010-09-05 19:00 ` [PATCH 5/8] drivers/atm/firestream.c: " Julia Lawall
@ 2010-09-05 19:00 ` Julia Lawall
2 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2010-09-05 19:00 UTC (permalink / raw)
To: Reinette Chatre
Cc: kernel-janitors, Wey-Yi Guy, Intel Linux Wireless,
John W. Linville, linux-wireless, netdev, linux-kernel
The function has an unsigned return type, but returns a negative constant
to indicate an error condition. Another error condition in the same
function is indicated by returning 0, and indeed the only call to the
function checks for 0 to detect errors, so the return of a negative value
it converted to a return of 0.
A sematic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@exists@
identifier f;
constant C;
@@
unsigned f(...)
{ <+...
* return -C;
...+> }
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/wireless/iwlwifi/iwl-agn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index ad0e67f..86b55c2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -369,7 +369,7 @@ static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
if (!priv->beacon_ctx) {
IWL_ERR(priv, "trying to build beacon w/o beacon context!\n");
- return -EINVAL;
+ return 0;
}
/* Initialize memory */
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 3/8] net/9p/trans_fd.c: Fix unsigned return type
2010-09-05 19:00 ` [PATCH 3/8] net/9p/trans_fd.c: Fix unsigned return type Julia Lawall
@ 2010-09-07 1:39 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-09-07 1:39 UTC (permalink / raw)
To: julia; +Cc: kernel-janitors, netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
Date: Sun, 5 Sep 2010 21:00:21 +0200
> The function has an unsigned return type, but returns a negative constant
> to indicate an error condition. The result of calling the function is
> always stored in a variable of type (signed) int, and thus unsigned can be
> dropped from the return type.
>
> A sematic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
...
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/8] drivers/atm/firestream.c: Fix unsigned return type
2010-09-05 19:00 ` [PATCH 5/8] drivers/atm/firestream.c: " Julia Lawall
@ 2010-09-07 1:40 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-09-07 1:40 UTC (permalink / raw)
To: julia; +Cc: chas, kernel-janitors, linux-atm-general, netdev, linux-kernel
From: Julia Lawall <julia@diku.dk>
Date: Sun, 5 Sep 2010 21:00:23 +0200
> The function has an unsigned return type, but returns a negative constant
> to indicate an error condition. The result of calling the function is
> always stored in a variable of type (signed) int, and thus unsigned can be
> dropped from the return type.
>
> A sematic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
...
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-07 1:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1283713226-8429-1-git-send-email-julia@diku.dk>
2010-09-05 19:00 ` [PATCH 3/8] net/9p/trans_fd.c: Fix unsigned return type Julia Lawall
2010-09-07 1:39 ` David Miller
2010-09-05 19:00 ` [PATCH 5/8] drivers/atm/firestream.c: " Julia Lawall
2010-09-07 1:40 ` David Miller
2010-09-05 19:00 ` [PATCH 8/8] drivers/net/wireless/iwlwifi/iwl-agn.c: Fix return value from an unsigned function Julia Lawall
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).