Commit 4b19f739 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] tty_driver refcounting

Fixes a couple of leaks in char_dev.c
parent 6cd8b047
...@@ -221,7 +221,7 @@ int register_chrdev(unsigned int major, const char *name, ...@@ -221,7 +221,7 @@ int register_chrdev(unsigned int major, const char *name,
out: out:
kobject_put(&cdev->kobj); kobject_put(&cdev->kobj);
out2: out2:
__unregister_chrdev_region(cd->major, 0, 256); kfree(__unregister_chrdev_region(cd->major, 0, 256));
return err; return err;
} }
...@@ -366,7 +366,10 @@ int cdev_add(struct cdev *p, dev_t dev, unsigned count) ...@@ -366,7 +366,10 @@ int cdev_add(struct cdev *p, dev_t dev, unsigned count)
int err = kobject_add(&p->kobj); int err = kobject_add(&p->kobj);
if (err) if (err)
return err; return err;
return kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p); err = kobj_map(cdev_map, dev, count, NULL, exact_match, exact_lock, p);
if (err)
kobject_del(&p->kobj);
return err;
} }
void cdev_unmap(dev_t dev, unsigned count) void cdev_unmap(dev_t dev, unsigned count)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment