From: Benjamin Tissoires Date: Mon, 27 Mar 2017 14:59:32 +0000 (+0200) Subject: HID: logitech-hidpp: return an error if the queried feature is not present X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a9525b80feb1b6ae40244b16b0558cbdc64f28cd;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Tested-by: Bastien Nocera Signed-off-by: Jiri Kosina --- 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, if (ret) return ret; + if (response.fap.params[0] == 0) + return -ENOENT; + *feature_index = response.fap.params[0]; *feature_type = response.fap.params[1];