Fix pn53x_initiator_target_is_present() when saved target is NULL

This patch prevents from running any command to check target presence when none have been saved
This commit is contained in:
Romuald Conty 2014-01-28 10:25:29 +01:00
parent 7a30e35496
commit 9a0a10826b

View file

@ -1728,6 +1728,11 @@ pn53x_initiator_deselect_target(struct nfc_device *pnd)
int int
pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt) pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt)
{ {
// Check if there is a saved target
if (CHIP_DATA(pnd)->current_target == NULL) {
return NFC_ETGRELEASED;
}
// Check if the argument target nt is equals to current saved target // Check if the argument target nt is equals to current saved target
if ((pnt != NULL) && (!pn53x_current_target_is(pnd, pnt))) { if ((pnt != NULL) && (!pn53x_current_target_is(pnd, pnt))) {
return NFC_ETGRELEASED; return NFC_ETGRELEASED;