diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-07-28 12:11:37 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-09-07 17:56:49 -0400 |
commit | 9ec1f58b9a8ecd72e675c33bfe8ceaf1bc0dc4c5 (patch) | |
tree | 2fb9ecdaf32008e74d08aabf5d5563cf78d8ad4f | |
parent | df2566fe37d92dfba032e6084ebfb708dac5dc9a (diff) |
NFC: st21nfca: Fix logic when setting session_id
If dev_num >= ST21NFCA_NUM_DEVICES, the driver was returning an incorrect
success return code.
Once dev_num is set, it was not stated as busy.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/nfc/st21nfca/st21nfca.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/nfc/st21nfca/st21nfca.c b/drivers/nfc/st21nfca/st21nfca.c index b6ad8c902f8d..438e06e6eb6a 100644 --- a/drivers/nfc/st21nfca/st21nfca.c +++ b/drivers/nfc/st21nfca/st21nfca.c | |||
@@ -905,8 +905,11 @@ int st21nfca_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops, | |||
905 | * persistent info to discriminate 2 identical chips | 905 | * persistent info to discriminate 2 identical chips |
906 | */ | 906 | */ |
907 | dev_num = find_first_zero_bit(dev_mask, ST21NFCA_NUM_DEVICES); | 907 | dev_num = find_first_zero_bit(dev_mask, ST21NFCA_NUM_DEVICES); |
908 | |||
908 | if (dev_num >= ST21NFCA_NUM_DEVICES) | 909 | if (dev_num >= ST21NFCA_NUM_DEVICES) |
909 | goto err_alloc_hdev; | 910 | return -ENODEV; |
911 | |||
912 | set_bit(dev_num, dev_mask); | ||
910 | 913 | ||
911 | scnprintf(init_data.session_id, sizeof(init_data.session_id), "%s%2x", | 914 | scnprintf(init_data.session_id, sizeof(init_data.session_id), "%s%2x", |
912 | "ST21AH", dev_num); | 915 | "ST21AH", dev_num); |