Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247076
b: refs/heads/master
c: c8d55a9
h: refs/heads/master
v: v3
  • Loading branch information
Kurt Van Dijck authored and David S. Miller committed May 4, 2011
1 parent 7f93e12 commit c858047
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1650629d1800bf05ad775f974e931ca2fa03b0ff
refs/heads/master: c8d55a9d9e257e67d02a6f673a943dd77e6bf24e
13 changes: 9 additions & 4 deletions trunk/net/can/af_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static void can_sock_destruct(struct sock *sk)
skb_queue_purge(&sk->sk_receive_queue);
}

static const struct can_proto *can_try_module_get(int protocol)
static const struct can_proto *can_get_proto(int protocol)
{
const struct can_proto *cp;

Expand All @@ -128,6 +128,11 @@ static const struct can_proto *can_try_module_get(int protocol)
return cp;
}

static inline void can_put_proto(const struct can_proto *cp)
{
module_put(cp->prot->owner);
}

static int can_create(struct net *net, struct socket *sock, int protocol,
int kern)
{
Expand All @@ -143,7 +148,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
if (!net_eq(net, &init_net))
return -EAFNOSUPPORT;

cp = can_try_module_get(protocol);
cp = can_get_proto(protocol);

#ifdef CONFIG_MODULES
if (!cp) {
Expand All @@ -160,7 +165,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
printk(KERN_ERR "can: request_module "
"(can-proto-%d) failed.\n", protocol);

cp = can_try_module_get(protocol);
cp = can_get_proto(protocol);
}
#endif

Expand Down Expand Up @@ -195,7 +200,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol,
}

errout:
module_put(cp->prot->owner);
can_put_proto(cp);
return err;
}

Expand Down

0 comments on commit c858047

Please sign in to comment.