Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359353
b: refs/heads/master
c: 3ab4ee8
h: refs/heads/master
i:
  359351: 7f6d45c
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent abe4ff6 commit 7dccf4c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 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: 9f12563db1e079aaf9821104e6dfff4873b3f4b6
refs/heads/master: 3ab4ee8f809cac9587e6795243349beda179f6ff
22 changes: 9 additions & 13 deletions trunk/drivers/misc/c2port/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ struct c2port_device *c2port_device_register(char *name,
struct c2port_ops *ops, void *devdata)
{
struct c2port_device *c2dev;
int id, ret;
int ret;

if (unlikely(!ops) || unlikely(!ops->access) || \
unlikely(!ops->c2d_dir) || unlikely(!ops->c2ck_set) || \
Expand All @@ -897,22 +897,18 @@ struct c2port_device *c2port_device_register(char *name,
if (unlikely(!c2dev))
return ERR_PTR(-ENOMEM);

ret = idr_pre_get(&c2port_idr, GFP_KERNEL);
if (!ret) {
ret = -ENOMEM;
goto error_idr_get_new;
}

idr_preload(GFP_KERNEL);
spin_lock_irq(&c2port_idr_lock);
ret = idr_get_new(&c2port_idr, c2dev, &id);
ret = idr_alloc(&c2port_idr, c2dev, 0, 0, GFP_NOWAIT);
spin_unlock_irq(&c2port_idr_lock);
idr_preload_end();

if (ret < 0)
goto error_idr_get_new;
c2dev->id = id;
goto error_idr_alloc;
c2dev->id = ret;

c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
"c2port%d", id);
"c2port%d", c2dev->id);
if (unlikely(IS_ERR(c2dev->dev))) {
ret = PTR_ERR(c2dev->dev);
goto error_device_create;
Expand Down Expand Up @@ -946,10 +942,10 @@ struct c2port_device *c2port_device_register(char *name,

error_device_create:
spin_lock_irq(&c2port_idr_lock);
idr_remove(&c2port_idr, id);
idr_remove(&c2port_idr, c2dev->id);
spin_unlock_irq(&c2port_idr_lock);

error_idr_get_new:
error_idr_alloc:
kfree(c2dev);

return ERR_PTR(ret);
Expand Down

0 comments on commit 7dccf4c

Please sign in to comment.