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>
This commit is contained in:
Ilpo Järvinen 2008-12-14 23:18:00 -08:00 committed by David S. Miller
parent 0eae1b98cf
commit 037322abe6
1 changed files with 7 additions and 6 deletions

View File

@ -298,18 +298,15 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
out: out:
write_unlock_bh(&rfcomm_dev_lock); write_unlock_bh(&rfcomm_dev_lock);
if (err < 0) { if (err < 0)
kfree(dev); goto free;
return err;
}
dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL);
if (IS_ERR(dev->tty_dev)) { if (IS_ERR(dev->tty_dev)) {
err = PTR_ERR(dev->tty_dev); err = PTR_ERR(dev->tty_dev);
list_del(&dev->list); list_del(&dev->list);
kfree(dev); goto free;
return err;
} }
dev_set_drvdata(dev->tty_dev, dev); dev_set_drvdata(dev->tty_dev, dev);
@ -321,6 +318,10 @@ out:
BT_ERR("Failed to create channel attribute"); BT_ERR("Failed to create channel attribute");
return dev->id; return dev->id;
free:
kfree(dev);
return err;
} }
static void rfcomm_dev_del(struct rfcomm_dev *dev) static void rfcomm_dev_del(struct rfcomm_dev *dev)