From 0785bf138d28532b047c98b4df78ba2d46c551a4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 28 Apr 2016 15:40:03 +1000 Subject: [PATCH] hidpp20: fail for hidpp10 devices hidpp10 devices have their own driver, let's not initialize them here and just fail. If a hidpp10 device is assigned the hidpp20 driver this is a bug. Signed-off-by: Peter Hutterer --- src/driver-hidpp20.c | 10 +++++----- src/hidpp20.c | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/driver-hidpp20.c b/src/driver-hidpp20.c index 66fdce04..f267d5d1 100644 --- a/src/driver-hidpp20.c +++ b/src/driver-hidpp20.c @@ -808,11 +808,9 @@ hidpp20drv_probe(struct ratbag_device *device) drv_data->num_resolutions = 1; drv_data->num_buttons = 8; - if (dev->proto_major >= 2) { - rc = hidpp20drv_20_probe(device); - if (rc) - goto err; - } + rc = hidpp20drv_20_probe(device); + if (rc) + goto err; ratbag_device_init_profiles(device, drv_data->num_profiles, @@ -823,6 +821,8 @@ hidpp20drv_probe(struct ratbag_device *device) err: free(drv_data); ratbag_set_drv_data(device, NULL); + if (dev) + hidpp20_device_destroy(dev); return rc; } diff --git a/src/hidpp20.c b/src/hidpp20.c index 38b82e42..2b707a2b 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -1892,6 +1892,9 @@ hidpp20_device_new(const struct hidpp_device *base, unsigned int idx) goto err; } + if (dev->proto_major < 2) + goto err; + rc = hidpp20_feature_set_get(dev); if (rc < 0) goto err;