aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorCaleb Connolly <caleb.connolly@linaro.org>2024-03-19 13:24:42 +0000
committerTom Rini <trini@konsulko.com>2024-03-20 17:13:05 -0400
commitd47e1fa8193774c960a5c9ad9688179d64aab66d (patch)
tree53416febe4be797670011a3a90dd53eabb565a33 /common
parent672af4f8acf94e70a65cfdc3ce47d2538a9b04fb (diff)
downloadu-boot-d47e1fa8193774c960a5c9ad9688179d64aab66d.zip
u-boot-d47e1fa8193774c960a5c9ad9688179d64aab66d.tar.gz
u-boot-d47e1fa8193774c960a5c9ad9688179d64aab66d.tar.bz2
test: dm: add button_cmd testWIP/20Mar2024-next
Add a test for the button_cmd feature. This validates that commands can be mapped to two buttons, that the correct command runs based on which button is pressed, that only 1 command is run, and that no command runs if button_cmd_0_name is wrong or unset. Additionally, fix a potential uninitialised variable use caught by these tests, the btn variable in get_button_cmd() is assumed to be null if button_get_by_label() fails, but it's actually used uninitialised in that case. CONFIG_BUTTON is now enabled automatically and was removed when running save_defconfig. Fixes: e761035b6423 ("boot: add support for button commands") Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
Diffstat (limited to 'common')
-rw-r--r--common/button_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/button_cmd.c b/common/button_cmd.c
index b6a8434..8642c26 100644
--- a/common/button_cmd.c
+++ b/common/button_cmd.c
@@ -33,7 +33,7 @@ struct button_cmd {
static int get_button_cmd(int n, struct button_cmd *cmd)
{
const char *cmd_str;
- struct udevice *btn;
+ struct udevice *btn = NULL;
char buf[24];
snprintf(buf, sizeof(buf), "button_cmd_%d_name", n);