aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2008-12-15 02:18:00 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-15 02:18:00 -0500
commit037322abe6141e32e1b1dea86a9405d52c99be5d (patch)
treef223a6e44f8243cef4d937ad4091af55e21424b7 /net/bluetooth
parent0eae1b98cf3022715b5a6ea5f1ac6b0bd7ac4edd (diff)
bt/rfcomm/tty: join error paths
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/rfcomm/tty.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
index 111c6c858247..d030c69cb5a3 100644
--- a/net/bluetooth/rfcomm/tty.c
+++ b/net/bluetooth/rfcomm/tty.c
@@ -298,18 +298,15 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
298out: 298out:
299 write_unlock_bh(&rfcomm_dev_lock); 299 write_unlock_bh(&rfcomm_dev_lock);
300 300
301 if (err < 0) { 301 if (err < 0)
302 kfree(dev); 302 goto free;
303 return err;
304 }
305 303
306 dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); 304 dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL);
307 305
308 if (IS_ERR(dev->tty_dev)) { 306 if (IS_ERR(dev->tty_dev)) {
309 err = PTR_ERR(dev->tty_dev); 307 err = PTR_ERR(dev->tty_dev);
310 list_del(&dev->list); 308 list_del(&dev->list);
311 kfree(dev); 309 goto free;
312 return err;
313 } 310 }
314 311
315 dev_set_drvdata(dev->tty_dev, dev); 312 dev_set_drvdata(dev->tty_dev, dev);
@@ -321,6 +318,10 @@ out:
321 BT_ERR("Failed to create channel attribute"); 318 BT_ERR("Failed to create channel attribute");
322 319
323 return dev->id; 320 return dev->id;
321
322free:
323 kfree(dev);
324 return err;
324} 325}
325 326
326static void rfcomm_dev_del(struct rfcomm_dev *dev) 327static void rfcomm_dev_del(struct rfcomm_dev *dev)