diff options
Diffstat (limited to 'drivers/power/bq2415x_charger.c')
-rw-r--r-- | drivers/power/bq2415x_charger.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index ca91396fc48e..0727f9256138 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c | |||
@@ -1515,16 +1515,11 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | /* Get new ID for the new device */ | 1517 | /* Get new ID for the new device */ |
1518 | ret = idr_pre_get(&bq2415x_id, GFP_KERNEL); | ||
1519 | if (ret == 0) | ||
1520 | return -ENOMEM; | ||
1521 | |||
1522 | mutex_lock(&bq2415x_id_mutex); | 1518 | mutex_lock(&bq2415x_id_mutex); |
1523 | ret = idr_get_new(&bq2415x_id, client, &num); | 1519 | num = idr_alloc(&bq2415x_id, client, 0, 0, GFP_KERNEL); |
1524 | mutex_unlock(&bq2415x_id_mutex); | 1520 | mutex_unlock(&bq2415x_id_mutex); |
1525 | 1521 | if (num < 0) | |
1526 | if (ret < 0) | 1522 | return num; |
1527 | return ret; | ||
1528 | 1523 | ||
1529 | name = kasprintf(GFP_KERNEL, "%s-%d", id->name, num); | 1524 | name = kasprintf(GFP_KERNEL, "%s-%d", id->name, num); |
1530 | if (!name) { | 1525 | if (!name) { |