diff options
-rw-r--r-- | net/wimax/op-msg.c | 11 | ||||
-rw-r--r-- | net/wimax/stack.c | 17 |
2 files changed, 21 insertions, 7 deletions
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c index 5d149c1b5f0..9ad4d893a56 100644 --- a/net/wimax/op-msg.c +++ b/net/wimax/op-msg.c | |||
@@ -149,7 +149,8 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev, | |||
149 | } | 149 | } |
150 | result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg); | 150 | result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg); |
151 | if (result < 0) { | 151 | if (result < 0) { |
152 | dev_err(dev, "no memory to add payload in attribute\n"); | 152 | dev_err(dev, "no memory to add payload (msg %p size %zu) in " |
153 | "attribute: %d\n", msg, size, result); | ||
153 | goto error_nla_put; | 154 | goto error_nla_put; |
154 | } | 155 | } |
155 | genlmsg_end(skb, genl_msg); | 156 | genlmsg_end(skb, genl_msg); |
@@ -299,10 +300,10 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name, | |||
299 | struct sk_buff *skb; | 300 | struct sk_buff *skb; |
300 | 301 | ||
301 | skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags); | 302 | skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags); |
302 | if (skb == NULL) | 303 | if (IS_ERR(skb)) |
303 | goto error_msg_new; | 304 | result = PTR_ERR(skb); |
304 | result = wimax_msg_send(wimax_dev, skb); | 305 | else |
305 | error_msg_new: | 306 | result = wimax_msg_send(wimax_dev, skb); |
306 | return result; | 307 | return result; |
307 | } | 308 | } |
308 | EXPORT_SYMBOL_GPL(wimax_msg); | 309 | EXPORT_SYMBOL_GPL(wimax_msg); |
diff --git a/net/wimax/stack.c b/net/wimax/stack.c index a0ee76b5251..933e1422b09 100644 --- a/net/wimax/stack.c +++ b/net/wimax/stack.c | |||
@@ -338,8 +338,21 @@ out: | |||
338 | */ | 338 | */ |
339 | void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state) | 339 | void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state) |
340 | { | 340 | { |
341 | /* | ||
342 | * A driver cannot take the wimax_dev out of the | ||
343 | * __WIMAX_ST_NULL state unless by calling wimax_dev_add(). If | ||
344 | * the wimax_dev's state is still NULL, we ignore any request | ||
345 | * to change its state because it means it hasn't been yet | ||
346 | * registered. | ||
347 | * | ||
348 | * There is no need to complain about it, as routines that | ||
349 | * call this might be shared from different code paths that | ||
350 | * are called before or after wimax_dev_add() has done its | ||
351 | * job. | ||
352 | */ | ||
341 | mutex_lock(&wimax_dev->mutex); | 353 | mutex_lock(&wimax_dev->mutex); |
342 | __wimax_state_change(wimax_dev, new_state); | 354 | if (wimax_dev->state > __WIMAX_ST_NULL) |
355 | __wimax_state_change(wimax_dev, new_state); | ||
343 | mutex_unlock(&wimax_dev->mutex); | 356 | mutex_unlock(&wimax_dev->mutex); |
344 | return; | 357 | return; |
345 | } | 358 | } |
@@ -376,7 +389,7 @@ EXPORT_SYMBOL_GPL(wimax_state_get); | |||
376 | void wimax_dev_init(struct wimax_dev *wimax_dev) | 389 | void wimax_dev_init(struct wimax_dev *wimax_dev) |
377 | { | 390 | { |
378 | INIT_LIST_HEAD(&wimax_dev->id_table_node); | 391 | INIT_LIST_HEAD(&wimax_dev->id_table_node); |
379 | __wimax_state_set(wimax_dev, WIMAX_ST_UNINITIALIZED); | 392 | __wimax_state_set(wimax_dev, __WIMAX_ST_NULL); |
380 | mutex_init(&wimax_dev->mutex); | 393 | mutex_init(&wimax_dev->mutex); |
381 | mutex_init(&wimax_dev->mutex_reset); | 394 | mutex_init(&wimax_dev->mutex_reset); |
382 | } | 395 | } |