input: kbd_matrix: fail gracefully if changing an undefined key mask
Add a check to input_kbd_matrix_actual_key_mask_set() to return an error if trying to change a key mask but the device does not define a keymask in the first place. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
parent
603c3af895
commit
2a99432695
|
@ -334,6 +334,11 @@ int input_kbd_matrix_actual_key_mask_set(const struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (cfg->actual_key_mask == NULL) {
|
||||
LOG_WRN("actual-key-mask not defined for %s", dev->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
WRITE_BIT(cfg->actual_key_mask[col], row, enabled);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue