aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2017-03-27 10:59:32 -0400
committerJiri Kosina <jkosina@suse.cz>2017-04-06 08:36:38 -0400
commita9525b80feb1b6ae40244b16b0558cbdc64f28cd (patch)
tree7e4afaaa44e435672db65a5a16612059d19d42f1
parenta52ec107fa81c8f799654b860e262f07bd14d63a (diff)
HID: logitech-hidpp: return an error if the queried feature is not present
Or the device just answers a valid feature '0'. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-logitech-hidpp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 9a9771a31108..22129ddac3ae 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -503,6 +503,9 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature,
503 if (ret) 503 if (ret)
504 return ret; 504 return ret;
505 505
506 if (response.fap.params[0] == 0)
507 return -ENOENT;
508
506 *feature_index = response.fap.params[0]; 509 *feature_index = response.fap.params[0];
507 *feature_type = response.fap.params[1]; 510 *feature_type = response.fap.params[1];
508 511