netpoll: don't dereference NULL dev from np
[safe/jmp/linux-2.6] / net / wimax / op-msg.c
index cb3b4ad..9ad4d89 100644 (file)
@@ -149,7 +149,8 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev,
        }
        result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg);
        if (result < 0) {
-               dev_err(dev, "no memory to add payload in attribute\n");
+               dev_err(dev, "no memory to add payload (msg %p size %zu) in "
+                       "attribute: %d\n", msg, size, result);
                goto error_nla_put;
        }
        genlmsg_end(skb, genl_msg);
@@ -258,7 +259,6 @@ EXPORT_SYMBOL_GPL(wimax_msg_len);
  */
 int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb)
 {
-       int result;
        struct device *dev = wimax_dev->net_dev->dev.parent;
        void *msg = skb->data;
        size_t size = skb->len;
@@ -266,11 +266,9 @@ int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb)
 
        d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size);
        d_dump(2, dev, msg, size);
-       result = genlmsg_multicast(skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
-       d_printf(1, dev, "CTX: genl multicast result %d\n", result);
-       if (result == -ESRCH)   /* Nobody connected, ignore it */
-               result = 0;     /* btw, the skb is freed already */
-       return result;
+       genlmsg_multicast(skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
+       d_printf(1, dev, "CTX: genl multicast done\n");
+       return 0;
 }
 EXPORT_SYMBOL_GPL(wimax_msg_send);
 
@@ -302,10 +300,10 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name,
        struct sk_buff *skb;
 
        skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags);
-       if (skb == NULL)
-               goto error_msg_new;
-       result = wimax_msg_send(wimax_dev, skb);
-error_msg_new:
+       if (IS_ERR(skb))
+               result = PTR_ERR(skb);
+       else
+               result = wimax_msg_send(wimax_dev, skb);
        return result;
 }
 EXPORT_SYMBOL_GPL(wimax_msg);