Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359351
b: refs/heads/master
c: 7b51f47
h: refs/heads/master
i:
  359349: 1dcd135
  359347: b9d86dd
  359343: b3b04a1
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent f28dd4d commit 7f6d45c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c9d76be696bbb76ba1081d2b0fc0086f449788da
refs/heads/master: 7b51f47835f61d9ee6273908b774a0f569e99646
21 changes: 10 additions & 11 deletions trunk/drivers/memstick/core/memstick.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,18 +512,17 @@ int memstick_add_host(struct memstick_host *host)
{
int rc;

while (1) {
if (!idr_pre_get(&memstick_host_idr, GFP_KERNEL))
return -ENOMEM;
idr_preload(GFP_KERNEL);
spin_lock(&memstick_host_lock);

spin_lock(&memstick_host_lock);
rc = idr_get_new(&memstick_host_idr, host, &host->id);
spin_unlock(&memstick_host_lock);
if (!rc)
break;
else if (rc != -EAGAIN)
return rc;
}
rc = idr_alloc(&memstick_host_idr, host, 0, 0, GFP_NOWAIT);
if (rc >= 0)
host->id = rc;

spin_unlock(&memstick_host_lock);
idr_preload_end();
if (rc < 0)
return rc;

dev_set_name(&host->dev, "memstick%u", host->id);

Expand Down
17 changes: 3 additions & 14 deletions trunk/drivers/memstick/core/mspro_block.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,21 +1213,10 @@ static int mspro_block_init_disk(struct memstick_dev *card)
msb->page_size = be16_to_cpu(sys_info->unit_size);

mutex_lock(&mspro_block_disk_lock);
if (!idr_pre_get(&mspro_block_disk_idr, GFP_KERNEL)) {
mutex_unlock(&mspro_block_disk_lock);
return -ENOMEM;
}

rc = idr_get_new(&mspro_block_disk_idr, card, &disk_id);
disk_id = idr_alloc(&mspro_block_disk_idr, card, 0, 256, GFP_KERNEL);
mutex_unlock(&mspro_block_disk_lock);

if (rc)
return rc;

if ((disk_id << MSPRO_BLOCK_PART_SHIFT) > 255) {
rc = -ENOSPC;
goto out_release_id;
}
if (disk_id < 0)
return disk_id;

msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT);
if (!msb->disk) {
Expand Down

0 comments on commit 7f6d45c

Please sign in to comment.