summaryrefslogtreecommitdiff
path: root/util/ectool_keyscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ectool_keyscan.c')
-rw-r--r--util/ectool_keyscan.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/util/ectool_keyscan.c b/util/ectool_keyscan.c
index 46ba221f6e..9470641ec7 100644
--- a/util/ectool_keyscan.c
+++ b/util/ectool_keyscan.c
@@ -78,8 +78,8 @@ static int keyscan_read_fdt_matrix(struct keyscan_info *keyscan,
return -1;
}
keyscan->matrix_count = buf.st_size / 4;
- keyscan->matrix = calloc(keyscan->matrix_count,
- sizeof(*keyscan->matrix));
+ keyscan->matrix = (struct matrix_entry *)(calloc(
+ keyscan->matrix_count, sizeof(*keyscan->matrix)));
if (!keyscan->matrix) {
fprintf(stderr, "Out of memory for key matrix\n");
return -1;
@@ -137,7 +137,7 @@ static const unsigned char kbd_plain_xlate[] = {
'8', '9', '-', '4', '5', '6', '+', '1', /* 0x40 - 0x4f */
'2', '3', '0', '.', 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* 0x50 - 0x5F */
- '\r', 0xff, 0xff
+ '\r', 0xff, 0xff, '\0'
};
/**
@@ -205,7 +205,7 @@ static int keyscan_add_to_scan(struct keyscan_info *keyscan, char **keysp,
/* Convert keycode to key if needed */
if (keycode == -1) {
- pos = strchr(kbd_plain_xlate, key);
+ pos = (uint8_t *)(strchr((char *)kbd_plain_xlate, key));
if (!pos) {
fprintf(stderr, "Key '%c' not found in xlate table\n",
key);
@@ -267,8 +267,9 @@ static int keyscan_process_keys(struct keyscan_info *keyscan, int linenum,
size = test->item_alloced * sizeof(struct keyscan_test_item);
new_size = size + KEYSCAN_ALLOC_STEP *
- sizeof(struct keyscan_test_item);
- test->items = realloc(test->items, new_size);
+ sizeof(struct keyscan_test_item);
+ test->items = (struct keyscan_test_item *)(realloc(test->items,
+ new_size));
if (!test->items) {
fprintf(stderr, "Out of memory realloc()\n");
return -1;
@@ -335,10 +336,10 @@ static enum keyscan_cmd keyscan_read_cmd(const char *str, int len)
for (i = 0; i < KEYSCAN_CMD_COUNT; i++) {
if (!strncmp(keyscan_cmd_name[i], str, len))
- return i;
+ return (enum keyscan_cmd)(i);
}
- return -1;
+ return (enum keyscan_cmd)(-1);
}
/**
@@ -584,7 +585,7 @@ static int run_test(struct keyscan_info *keyscan, struct keyscan_test *test)
/* Ask EC for results */
size = sizeof(*resp) + test->item_count;
- resp = malloc(size);
+ resp = (struct ec_result_keyscan_seq_ctrl *)(malloc(size));
if (!resp) {
fprintf(stderr, "Out of memory for results\n");
return -1;