]> Pileus Git - ~andy/linux/blobdiff - drivers/power/bq27x00_battery.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
[~andy/linux] / drivers / power / bq27x00_battery.c
index 8ccf5d7d0add29c12c7830036b1881977ec3f188..26037ca7efb49cf78c8ed41d097f6bad6f5ffc5b 100644 (file)
@@ -791,14 +791,11 @@ static int bq27x00_battery_probe(struct i2c_client *client,
        int retval = 0;
 
        /* Get new ID for the new battery device */
-       retval = idr_pre_get(&battery_id, GFP_KERNEL);
-       if (retval == 0)
-               return -ENOMEM;
        mutex_lock(&battery_mutex);
-       retval = idr_get_new(&battery_id, client, &num);
+       num = idr_alloc(&battery_id, client, 0, 0, GFP_KERNEL);
        mutex_unlock(&battery_mutex);
-       if (retval < 0)
-               return retval;
+       if (num < 0)
+               return num;
 
        name = kasprintf(GFP_KERNEL, "%s-%d", id->name, num);
        if (!name) {