HID: logitech-hidpp: return an error if the queried feature is not present
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Mon, 27 Mar 2017 14:59:32 +0000 (16:59 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 6 Apr 2017 12:36:38 +0000 (14:36 +0200)
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>
drivers/hid/hid-logitech-hidpp.c

index 9a9771a311087e85d9a8fdd512d7fcc1c9cbd7cc..22129ddac3aeaea8abfe3a34f8f99e2d4559fe98 100644 (file)
@@ -503,6 +503,9 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature,
        if (ret)
                return ret;
 
+       if (response.fap.params[0] == 0)
+               return -ENOENT;
+
        *feature_index = response.fap.params[0];
        *feature_type = response.fap.params[1];