mISDN: get_free_devid() failure ignored
authorRoel Kluin <roel.kluin@gmail.com>
Fri, 22 May 2009 11:04:53 +0000 (11:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 May 2009 07:55:31 +0000 (00:55 -0700)
dev->id is unsigned so a get_free_devid() error is ignored.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Karsten Keil <keil@b1-systems.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/mISDN/core.c

index 9426c9827e47307c24efa3de435651864cb7eb72..21d34be5af6a2300fa49b646515e0413eea77db0 100644 (file)
@@ -214,7 +214,7 @@ get_free_devid(void)
                if (!test_and_set_bit(i, (u_long *)&device_ids))
                        break;
        if (i > MAX_DEVICE_ID)
-               return -1;
+               return -EBUSY;
        return i;
 }
 
@@ -224,10 +224,10 @@ mISDN_register_device(struct mISDNdevice *dev,
 {
        int     err;
 
-       dev->id = get_free_devid();
-       err = -EBUSY;
-       if (dev->id < 0)
+       err = get_free_devid();
+       if (err < 0)
                goto error1;
+       dev->id = err;
 
        device_initialize(&dev->dev);
        if (name && name[0])