aboutsummaryrefslogtreecommitdiffstats
path: root/net/can
diff options
context:
space:
mode:
Diffstat (limited to 'net/can')
-rw-r--r--net/can/af_can.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c
index 5158e886630f..1f51b8a18242 100644
--- a/net/can/af_can.c
+++ b/net/can/af_can.c
@@ -118,7 +118,6 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
118{ 118{
119 struct sock *sk; 119 struct sock *sk;
120 struct can_proto *cp; 120 struct can_proto *cp;
121 char module_name[sizeof("can-proto-000")];
122 int err = 0; 121 int err = 0;
123 122
124 sock->state = SS_UNCONNECTED; 123 sock->state = SS_UNCONNECTED;
@@ -129,26 +128,21 @@ static int can_create(struct net *net, struct socket *sock, int protocol)
129 if (net != &init_net) 128 if (net != &init_net)
130 return -EAFNOSUPPORT; 129 return -EAFNOSUPPORT;
131 130
131#ifdef CONFIG_KMOD
132 /* try to load protocol module, when CONFIG_KMOD is defined */ 132 /* try to load protocol module, when CONFIG_KMOD is defined */
133 if (!proto_tab[protocol]) { 133 if (!proto_tab[protocol]) {
134 sprintf(module_name, "can-proto-%d", protocol); 134 err = request_module("can-proto-%d", protocol);
135 err = request_module(module_name);
136 135
137 /* 136 /*
138 * In case of error we only print a message but don't 137 * In case of error we only print a message but don't
139 * return the error code immediately. Below we will 138 * return the error code immediately. Below we will
140 * return -EPROTONOSUPPORT 139 * return -EPROTONOSUPPORT
141 */ 140 */
142 if (err == -ENOSYS) { 141 if (err && printk_ratelimit())
143 if (printk_ratelimit()) 142 printk(KERN_ERR "can: request_module "
144 printk(KERN_INFO "can: request_module(%s)" 143 "(can-proto-%d) failed.\n", protocol);
145 " not implemented.\n", module_name);
146 } else if (err) {
147 if (printk_ratelimit())
148 printk(KERN_ERR "can: request_module(%s)"
149 " failed.\n", module_name);
150 }
151 } 144 }
145#endif
152 146
153 spin_lock(&proto_tab_lock); 147 spin_lock(&proto_tab_lock);
154 cp = proto_tab[protocol]; 148 cp = proto_tab[protocol];