hidpp10: error out if we deal with unsupported profiles

Just logging and error and continuing is not enough, we'll eventually
dereference garbage values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2017-07-10 15:37:11 +10:00
committed by Benjamin Tissoires
parent 37c8dec45c
commit 04990e4ea2

View File

@@ -1691,6 +1691,7 @@ hidpp10_set_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr
break;
default:
hidpp_log_error(&dev->base, "This should never happen, complain to your maintainer.\n");
return -ENOTSUP;
}
@@ -1711,6 +1712,7 @@ hidpp10_set_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr
break;
default:
hidpp_log_error(&dev->base, "This should never happen, complain to your maintainer.\n");
return -ENOTSUP;
}
switch (dev->profile_type) {
@@ -1747,6 +1749,7 @@ hidpp10_set_profile(struct hidpp10_device *dev, int8_t number, struct hidpp10_pr
break;
default:
hidpp_log_error(&dev->base, "This should never happen, complain to your maintainer.\n");
return -ENOTSUP;
}
crc = hidpp_crc_ccitt(page_data, HIDPP10_PAGE_SIZE - 2);