diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-05-10 15:53:29 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-14 13:45:00 +0200 |
commit | ee656e9d0993144f4e4ad261aefeeaab9554cd3f (patch) | |
tree | 03d990b310cd75edfcf6079777c6619ff4b50ebc /net/nfc/core.c | |
parent | NFC: Send netlink events for secure elements additions and removals (diff) | |
download | linux-ee656e9d0993144f4e4ad261aefeeaab9554cd3f.tar.xz linux-ee656e9d0993144f4e4ad261aefeeaab9554cd3f.zip |
NFC: Remove and free all SEs when releasing an NFC device
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/core.c')
-rw-r--r-- | net/nfc/core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c index bb5f16cfc201..5b60b9ddfc8f 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c @@ -820,11 +820,19 @@ EXPORT_SYMBOL(nfc_remove_se); static void nfc_release(struct device *d) { struct nfc_dev *dev = to_nfc_dev(d); + struct nfc_se *se, *n; pr_debug("dev_name=%s\n", dev_name(&dev->dev)); nfc_genl_data_exit(&dev->genl_data); kfree(dev->targets); + + list_for_each_entry_safe(se, n, &dev->secure_elements, list) { + nfc_genl_se_removed(dev, se->idx); + list_del(&se->list); + kfree(se); + } + kfree(dev); } |