diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 23ba61a13bdd..22a832098d44 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -267,7 +267,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc) | |||
267 | out: | 267 | out: |
268 | write_unlock_bh(&rfcomm_dev_lock); | 268 | write_unlock_bh(&rfcomm_dev_lock); |
269 | 269 | ||
270 | if (err) { | 270 | if (err < 0) { |
271 | kfree(dev); | 271 | kfree(dev); |
272 | return err; | 272 | return err; |
273 | } | 273 | } |
@@ -275,9 +275,10 @@ out: | |||
275 | dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); | 275 | dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); |
276 | 276 | ||
277 | if (IS_ERR(dev->tty_dev)) { | 277 | if (IS_ERR(dev->tty_dev)) { |
278 | err = PTR_ERR(dev->tty_dev); | ||
278 | list_del(&dev->list); | 279 | list_del(&dev->list); |
279 | kfree(dev); | 280 | kfree(dev); |
280 | return PTR_ERR(dev->tty_dev); | 281 | return err; |
281 | } | 282 | } |
282 | 283 | ||
283 | return dev->id; | 284 | return dev->id; |