* [PATCH] sixaxis: Fix device detection
@ 2013-12-12 16:16 Bastien Nocera
2013-12-13 9:54 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Bastien Nocera @ 2013-12-12 16:16 UTC (permalink / raw)
To: linux-bluetooth
After searching past the end of the structure, the loop sometimes
found matches in the daemon's address space...
This fixes the loop to end after the elements have been exhausted.
---
plugins/sixaxis.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 45fa170..1154c15 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -301,7 +301,7 @@ static int get_supported_device(struct udev_device *udevice, uint16_t *bus)
struct udev_device *hid_parent;
uint16_t vid, pid;
const char *hid_id;
- int i;
+ guint i;
hid_parent = udev_device_get_parent_with_subsystem_devtype(udevice,
"hid", NULL);
@@ -313,7 +313,7 @@ static int get_supported_device(struct udev_device *udevice, uint16_t *bus)
if (sscanf(hid_id, "%hx:%hx:%hx", bus, &vid, &pid) != 3)
return -1;
- for (i = 0; G_N_ELEMENTS(devices); i++) {
+ for (i = 0; i < G_N_ELEMENTS(devices); i++) {
if (devices[i].vid == vid && devices[i].pid == pid)
return i;
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sixaxis: Fix device detection
2013-12-12 16:16 [PATCH] sixaxis: Fix device detection Bastien Nocera
@ 2013-12-13 9:54 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2013-12-13 9:54 UTC (permalink / raw)
To: Bastien Nocera; +Cc: linux-bluetooth
Hi Bastien,
On Thu, Dec 12, 2013, Bastien Nocera wrote:
> After searching past the end of the structure, the loop sometimes
> found matches in the daemon's address space...
>
> This fixes the loop to end after the elements have been exhausted.
> ---
> plugins/sixaxis.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-13 9:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-12 16:16 [PATCH] sixaxis: Fix device detection Bastien Nocera
2013-12-13 9:54 ` Johan Hedberg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.