NFC: Fix next target_idx type and rename for clarity
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Родитель
c4fbb6515a
Коммит
01ae0eea9b
|
@ -89,7 +89,7 @@ struct nfc_genl_data {
|
||||||
|
|
||||||
struct nfc_dev {
|
struct nfc_dev {
|
||||||
unsigned idx;
|
unsigned idx;
|
||||||
unsigned target_idx;
|
u32 target_next_idx;
|
||||||
struct nfc_target *targets;
|
struct nfc_target *targets;
|
||||||
int n_targets;
|
int n_targets;
|
||||||
int targets_generation;
|
int targets_generation;
|
||||||
|
|
|
@ -435,7 +435,7 @@ int nfc_targets_found(struct nfc_dev *dev,
|
||||||
dev->polling = false;
|
dev->polling = false;
|
||||||
|
|
||||||
for (i = 0; i < n_targets; i++)
|
for (i = 0; i < n_targets; i++)
|
||||||
targets[i].idx = dev->target_idx++;
|
targets[i].idx = dev->target_next_idx++;
|
||||||
|
|
||||||
spin_lock_bh(&dev->targets_lock);
|
spin_lock_bh(&dev->targets_lock);
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr->target_idx > dev->target_idx - 1 ||
|
if (addr->target_idx > dev->target_next_idx - 1 ||
|
||||||
addr->target_idx < dev->target_idx - dev->n_targets) {
|
addr->target_idx < dev->target_next_idx - dev->n_targets) {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче