sinowealth: return an error code instead of doing an assert

While I doubt it will actually ever get hit, there is no reason to crash
the whole daemon because of this.
This commit is contained in:
Yaroslav Chvanov
2022-02-01 15:25:45 +03:00
committed by Ilya guterman
parent 0608a0156d
commit e7cc62a9c8

View File

@@ -524,7 +524,10 @@ sinowealth_get_active_profile(struct ratbag_device *device)
static int
sinowealth_set_active_profile(struct ratbag_device *device, unsigned int index)
{
assert(index <= SINOWEALTH_NUM_PROFILES - 1);
if (index >= SINOWEALTH_NUM_PROFILES) {
log_error(device->ratbag, "Profile index %u is out of range", index);
return -EINVAL;
}
int rc = 0;