diff options
| -rw-r--r-- | drivers/char/tty_ldisc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 39c8f86dedd4..94b3e06d73ec 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
| @@ -148,8 +148,10 @@ static struct tty_ldisc *tty_ldisc_try_get(int disc) | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); | 150 | spin_unlock_irqrestore(&tty_ldisc_lock, flags); |
| 151 | if (err) | 151 | if (err) { |
| 152 | kfree(ld); | ||
| 152 | return ERR_PTR(err); | 153 | return ERR_PTR(err); |
| 154 | } | ||
| 153 | return ld; | 155 | return ld; |
| 154 | } | 156 | } |
| 155 | 157 | ||
| @@ -262,7 +264,7 @@ const struct file_operations tty_ldiscs_proc_fops = { | |||
| 262 | * @ld: line discipline | 264 | * @ld: line discipline |
| 263 | * | 265 | * |
| 264 | * Install an instance of a line discipline into a tty structure. The | 266 | * Install an instance of a line discipline into a tty structure. The |
| 265 | * ldisc must have a reference count above zero to ensure it remains/ | 267 | * ldisc must have a reference count above zero to ensure it remains. |
| 266 | * The tty instance refcount starts at zero. | 268 | * The tty instance refcount starts at zero. |
| 267 | * | 269 | * |
| 268 | * Locking: | 270 | * Locking: |
