summaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/digital_core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c
index 27769ac89d274..6e0b255aec660 100644
--- a/net/nfc/digital_core.c
+++ b/net/nfc/digital_core.c
@@ -842,6 +842,14 @@ void nfc_digital_unregister_device(struct nfc_digital_dev *ddev)
list_for_each_entry_safe(cmd, n, &ddev->cmd_queue, queue) {
list_del(&cmd->queue);
+
+ /* Call the command callback if any and pass it a ENODEV error.
+ * This gives a chance to the command issuer to free any
+ * allocated buffer.
+ */
+ if (cmd->cmd_cb)
+ cmd->cmd_cb(ddev, cmd->cb_context, ERR_PTR(-ENODEV));
+
kfree(cmd->mdaa_params);
kfree(cmd);
}