Merge remote-tracking branch 'regulator/fix/db8500' into tmp
[firefly-linux-kernel-4.4.55.git] / drivers / power / ds2782_battery.c
index e7301b3ed6237566de0325b53645dd15c4b6a769..c09e7726c96cc25c6b890872db9b64f4f7903b52 100644 (file)
@@ -395,17 +395,12 @@ static int ds278x_battery_probe(struct i2c_client *client,
        }
 
        /* Get an ID for this battery */
-       ret = idr_pre_get(&battery_id, GFP_KERNEL);
-       if (ret == 0) {
-               ret = -ENOMEM;
-               goto fail_id;
-       }
-
        mutex_lock(&battery_lock);
-       ret = idr_get_new(&battery_id, client, &num);
+       ret = idr_alloc(&battery_id, client, 0, 0, GFP_KERNEL);
        mutex_unlock(&battery_lock);
        if (ret < 0)
                goto fail_id;
+       num = ret;
 
        info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (!info) {