* [PATCH] phonet: sparse annotations of protocol, remove forward declaration
@ 2008-11-07 1:53 Harvey Harrison
2008-11-07 7:11 ` David Miller
2008-11-07 8:41 ` Rémi Denis-Courmont
0 siblings, 2 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-11-07 1:53 UTC (permalink / raw)
To: Remi Denis-Courmont; +Cc: linux-netdev, David Miller
net/phonet/af_phonet.c:38:36: error: marked inline, but without a definition
net/phonet/pep-gprs.c:63:10: warning: incorrect type in return expression (different base types)
net/phonet/pep-gprs.c:63:10: expected int
net/phonet/pep-gprs.c:63:10: got restricted __be16 [usertype] <noident>
net/phonet/pep-gprs.c:65:10: warning: incorrect type in return expression (different base types)
net/phonet/pep-gprs.c:65:10: expected int
net/phonet/pep-gprs.c:65:10: got restricted __be16 [usertype] <noident>
net/phonet/pep-gprs.c:124:16: warning: incorrect type in assignment (different base types)
net/phonet/pep-gprs.c:124:16: expected restricted __be16 [usertype] protocol
net/phonet/pep-gprs.c:124:16: got unsigned short [unsigned] [usertype] protocol
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
net/phonet/af_phonet.c | 11 +++++------
net/phonet/pep-gprs.c | 8 ++++----
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index defeb7a..f400ff1 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -35,7 +35,11 @@
static struct net_proto_family phonet_proto_family;
static struct phonet_protocol *phonet_proto_get(int protocol);
-static inline void phonet_proto_put(struct phonet_protocol *pp);
+
+static inline void phonet_proto_put(struct phonet_protocol *pp)
+{
+ module_put(pp->prot->owner);
+}
/* protocol family functions */
@@ -428,11 +432,6 @@ static struct phonet_protocol *phonet_proto_get(int protocol)
return pp;
}
-static inline void phonet_proto_put(struct phonet_protocol *pp)
-{
- module_put(pp->prot->owner);
-}
-
/* Module registration */
static int __init phonet_init(void)
{
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index 9978afb..a432407 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -49,14 +49,14 @@ struct gprs_dev {
unsigned tx_max;
};
-static int gprs_type_trans(struct sk_buff *skb)
+static __be16 gprs_type_trans(struct sk_buff *skb)
{
const u8 *pvfc;
u8 buf;
pvfc = skb_header_pointer(skb, 0, 1, &buf);
if (!pvfc)
- return 0;
+ return htons(0);
/* Look at IP version field */
switch (*pvfc >> 4) {
case 4:
@@ -64,7 +64,7 @@ static int gprs_type_trans(struct sk_buff *skb)
case 6:
return htons(ETH_P_IPV6);
}
- return 0;
+ return htons(0);
}
/*
@@ -84,7 +84,7 @@ static void gprs_state_change(struct sock *sk)
static int gprs_recv(struct gprs_dev *dev, struct sk_buff *skb)
{
int err = 0;
- u16 protocol = gprs_type_trans(skb);
+ __be16 protocol = gprs_type_trans(skb);
if (!protocol) {
err = -EINVAL;
--
1.6.0.3.756.gb776d
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] phonet: sparse annotations of protocol, remove forward declaration
2008-11-07 1:53 [PATCH] phonet: sparse annotations of protocol, remove forward declaration Harvey Harrison
@ 2008-11-07 7:11 ` David Miller
2008-11-07 8:41 ` Rémi Denis-Courmont
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2008-11-07 7:11 UTC (permalink / raw)
To: harvey.harrison; +Cc: remi.denis-courmont, netdev
From: Harvey Harrison <harvey.harrison@gmail.com>
Date: Thu, 06 Nov 2008 17:53:13 -0800
> net/phonet/af_phonet.c:38:36: error: marked inline, but without a definition
> net/phonet/pep-gprs.c:63:10: warning: incorrect type in return expression (different base types)
> net/phonet/pep-gprs.c:63:10: expected int
> net/phonet/pep-gprs.c:63:10: got restricted __be16 [usertype] <noident>
> net/phonet/pep-gprs.c:65:10: warning: incorrect type in return expression (different base types)
> net/phonet/pep-gprs.c:65:10: expected int
> net/phonet/pep-gprs.c:65:10: got restricted __be16 [usertype] <noident>
> net/phonet/pep-gprs.c:124:16: warning: incorrect type in assignment (different base types)
> net/phonet/pep-gprs.c:124:16: expected restricted __be16 [usertype] protocol
> net/phonet/pep-gprs.c:124:16: got unsigned short [unsigned] [usertype] protocol
>
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Looks good, applied to net-next-2.6
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] phonet: sparse annotations of protocol, remove forward declaration
2008-11-07 1:53 [PATCH] phonet: sparse annotations of protocol, remove forward declaration Harvey Harrison
2008-11-07 7:11 ` David Miller
@ 2008-11-07 8:41 ` Rémi Denis-Courmont
2008-11-07 20:02 ` Harvey Harrison
1 sibling, 1 reply; 4+ messages in thread
From: Rémi Denis-Courmont @ 2008-11-07 8:41 UTC (permalink / raw)
To: ext Harvey Harrison; +Cc: linux-netdev
On Friday 07 November 2008 03:53:13 ext Harvey Harrison, you wrote:
> net/phonet/af_phonet.c:38:36: error: marked inline, but without a
> definition
> net/phonet/pep-gprs.c:63:10: warning: incorrect type in return
> expression (different base types)
> net/phonet/pep-gprs.c:63:10: expected int
> net/phonet/pep-gprs.c:63:10: got restricted __be16 [usertype]
> <noident>
> net/phonet/pep-gprs.c:65:10: warning: incorrect type in return
> expression
> (different base types)
> net/phonet/pep-gprs.c:65:10: expected int
> net/phonet/pep-gprs.c:65:10: got restricted __be16 [usertype]
> <noident>
> net/phonet/pep-gprs.c:124:16: warning: incorrect type in assignment
> (different base types)
> net/phonet/pep-gprs.c:124:16: expected restricted
> __be16 [usertype] protocol
> net/phonet/pep-gprs.c:124:16: got unsigned short [unsigned]
> [usertype] protocol
Thanks. May I ask where the documentation to run these checks is?
--
Rémi Denis-Courmont
Maemo Software, Nokia Devices R&D
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] phonet: sparse annotations of protocol, remove forward declaration
2008-11-07 8:41 ` Rémi Denis-Courmont
@ 2008-11-07 20:02 ` Harvey Harrison
0 siblings, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-11-07 20:02 UTC (permalink / raw)
To: Rémi Denis-Courmont; +Cc: linux-netdev
On Fri, 2008-11-07 at 10:41 +0200, Rémi Denis-Courmont wrote:
> On Friday 07 November 2008 03:53:13 ext Harvey Harrison, you wrote:
> > net/phonet/af_phonet.c:38:36: error: marked inline, but without a
> > definition
> > net/phonet/pep-gprs.c:63:10: warning: incorrect type in return
> > expression (different base types)
> > net/phonet/pep-gprs.c:63:10: expected int
> > net/phonet/pep-gprs.c:63:10: got restricted __be16 [usertype]
> > <noident>
> > net/phonet/pep-gprs.c:65:10: warning: incorrect type in return
> > expression
> > (different base types)
> > net/phonet/pep-gprs.c:65:10: expected int
> > net/phonet/pep-gprs.c:65:10: got restricted __be16 [usertype]
> > <noident>
> > net/phonet/pep-gprs.c:124:16: warning: incorrect type in assignment
> > (different base types)
> > net/phonet/pep-gprs.c:124:16: expected restricted
> > __be16 [usertype] protocol
> > net/phonet/pep-gprs.c:124:16: got unsigned short [unsigned]
> > [usertype] protocol
>
> Thanks. May I ask where the documentation to run these checks is?
>
You need to add the -D__CHECK_ENDIAN__ flag to sparse to enable these
checks.
make C=1 CF=-D__CHECK_ENDIAN__
should do the trick if you have sparse already.
Harvey
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-07 20:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-07 1:53 [PATCH] phonet: sparse annotations of protocol, remove forward declaration Harvey Harrison
2008-11-07 7:11 ` David Miller
2008-11-07 8:41 ` Rémi Denis-Courmont
2008-11-07 20:02 ` Harvey Harrison
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).