From 64037febdcb8ca3e2fc363b87fa711f4577f58a7 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Mon, 9 May 2016 19:51:46 +0200 Subject: [PATCH] hidpp20: fix return path for hidpp20_onboard_profiles_read A negative error means a communication error, while a positive one means a HID++ one. Make sure we abort early enough. Signed-off-by: Benjamin Tissoires --- src/hidpp20.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hidpp20.c b/src/hidpp20.c index 2b707a2b..b922ab8a 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -1571,7 +1571,7 @@ hidpp20_onboard_profiles_find_and_read_profile(struct hidpp20_device *device, index + 1, i * 0x10, data + i * 0x10); - if (rc < 0) + if (rc != 0) return rc; } @@ -1761,7 +1761,7 @@ int hidpp20_onboard_profiles_read(struct hidpp20_device *device, return -EINVAL; rc = hidpp20_onboard_profiles_find_and_read_profile(device, index, data); - if (rc < 0) + if (rc != 0) return rc; profile->report_rate = 1000 / max(1, pdata.profile.report_rate);