|
@@ -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) {
|