Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315287
b: refs/heads/master
c: d94f9c5
h: refs/heads/master
i:
  315285: 56bdb96
  315283: 5ad17e9
  315279: 236ffd0
v: v3
  • Loading branch information
Eric Lapuyade authored and John W. Linville committed Jul 9, 2012
1 parent 1422aa8 commit 2251b1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8668fdd6efb3a75e0d58a3287a47fa7e60a68a73
refs/heads/master: d94f9c55ff22397cc3436840437da533e9263716
19 changes: 13 additions & 6 deletions trunk/net/nfc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ EXPORT_SYMBOL(nfc_alloc_recv_skb);
* The device driver must call this function when one or many nfc targets
* are found. After calling this function, the device driver must stop
* polling for targets.
* NOTE: This function can be called with targets=NULL and n_targets=0 to
* notify a driver error, meaning that the polling operation cannot complete.
* IMPORTANT: this function must not be called from an atomic context.
* In addition, it must also not be called from a context that would prevent
* the NFC Core to call other nfc ops entry point concurrently.
Expand All @@ -586,13 +588,18 @@ int nfc_targets_found(struct nfc_dev *dev,
dev->targets_generation++;

kfree(dev->targets);
dev->targets = kmemdup(targets, n_targets * sizeof(struct nfc_target),
GFP_ATOMIC);
dev->targets = NULL;

if (!dev->targets) {
dev->n_targets = 0;
device_unlock(&dev->dev);
return -ENOMEM;
if (targets) {
dev->targets = kmemdup(targets,
n_targets * sizeof(struct nfc_target),
GFP_ATOMIC);

if (!dev->targets) {
dev->n_targets = 0;
device_unlock(&dev->dev);
return -ENOMEM;
}
}

dev->n_targets = n_targets;
Expand Down

0 comments on commit 2251b1f

Please sign in to comment.