diff options
author | Thierry Escande <thierry.escande@collabora.com> | 2016-06-16 20:24:43 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2016-07-06 10:09:47 +0200 |
commit | 82e57952869fbbdf09d8f9e7ac284df13741e93d (patch) | |
tree | 3c2068c7d7970eaedb477c6139c788c5d3be9cfb /net/nfc/digital_core.c | |
parent | 3f89fea35fc37b326d6b3697fcc9cba235a60811 (diff) |
NFC: digital: Call pending command callbacks at device unregister
With this patch, when freeing the command queue in the module unregister
function, the callbacks of the commands still queued are called with a
ENODEV error. This gives a chance to the command issuer to free any
memory it could have allocate.
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/digital_core.c')
-rw-r--r-- | net/nfc/digital_core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c index 27769ac89d27..6e0b255aec66 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); } |