From fbdb41b073ba9140d0bf2a0a2545adb2930d5835 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Fri, 27 Jan 2023 13:42:32 +0300 Subject: [PATCH] hidpp10: return EINVAL instead of aborting While these indicate an obvious error in the caller's code, there is no need to crash the whole program because of this. --- src/hidpp10.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hidpp10.c b/src/hidpp10.c index 66e0b884..1cc23d40 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -180,7 +180,8 @@ hidpp10_request_command(struct hidpp10_device *dev, union hidpp10_message *msg) command_size = LONG_MESSAGE_LENGTH; break; default: - abort(); + hidpp_log_error(&dev->base, "Incorrect message report id: %02x\n", msg->msg.report_id); + return -EINVAL; } /* create the expected header */ @@ -1943,7 +1944,8 @@ hidpp10_set_led_status(struct hidpp10_device *dev, case HIDPP10_LED_STATUS_SLOW_OFF: break; default: - abort(); + hidpp_log_error(&dev->base, "Incorrect LED status: %02x\n", led[i]); + return -EINVAL; } }