HID: logitech-hidpp: return an error if the queried feature is not present
authorBenjamin Tissoires <[email protected]>
Mon, 27 Mar 2017 14:59:32 +0000 (16:59 +0200)
committerJiri Kosina <[email protected]>
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 <[email protected]>
Tested-by: Bastien Nocera <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
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];