node, notify, pool: remove some more BUG_ON()
authorDaniel Mack <daniel@zonque.org>
Sat, 20 Dec 2014 14:35:41 +0000 (15:35 +0100)
committerDaniel Mack <daniel@zonque.org>
Sat, 20 Dec 2014 14:35:41 +0000 (15:35 +0100)
Signed-off-by: Daniel Mack <daniel@zonque.org>
node.c
notify.c
pool.c

diff --git a/node.c b/node.c
index 4e7c32fede9818b9a69a3bfa4134f4db82164537..96cd2aa88facf0d8725d6eab1f9e2b5af1c4cb45 100644 (file)
--- a/node.c
+++ b/node.c
@@ -321,8 +321,11 @@ int kdbus_node_link(struct kdbus_node *node, struct kdbus_node *parent,
 {
        int ret;
 
-       BUG_ON(node->type != KDBUS_NODE_DOMAIN && !parent);
-       BUG_ON(parent && !name);
+       if (WARN_ON(node->type != KDBUS_NODE_DOMAIN && !parent))
+               return -EINVAL;
+
+       if (WARN_ON(parent && !name))
+               return -EINVAL;
 
        if (name) {
                node->name = kstrdup(name, GFP_KERNEL);
index 1a55d98f936724c017b5de50fd228ba4192fa21e..47f91da3fd743327768c83fee66eb6ab22a0ac6c 100644 (file)
--- a/notify.c
+++ b/notify.c
@@ -40,7 +40,7 @@ static int kdbus_notify_reply(struct kdbus_bus *bus, u64 id,
 {
        struct kdbus_kmsg *kmsg = NULL;
 
-       BUG_ON(id == 0);
+       WARN_ON(id == 0);
 
        kmsg = kdbus_kmsg_new(0);
        if (IS_ERR(kmsg))
diff --git a/pool.c b/pool.c
index fdba1598eccd7cec44ec397b755efdfe6a0cb6ad..2fea78b94a0829ab281e6ea458ce679391e63826 100644 (file)
--- a/pool.c
+++ b/pool.c
@@ -210,7 +210,8 @@ struct kdbus_pool_slice *kdbus_pool_slice_alloc(struct kdbus_pool *pool,
        struct kdbus_pool_slice *s;
        int ret = 0;
 
-       BUG_ON(kvec && iovec);
+       if (WARN_ON(kvec && iovec))
+               return ERR_PTR(-EINVAL);
 
        /* search a free slice with the closest matching size */
        mutex_lock(&pool->lock);