[U-Boot] [PATCH] power: fix: Do not execute pmic command when not all necessary parameters are passed

Lukasz Majewski l.majewski at samsung.com
Mon Feb 24 13:33:08 CET 2014


Lack of this check resulted in a data abort when CPU tried to execute the
following command (without further mandatory input): 'pmic MAX77686_PMIC'.

Only the 'pmic list' command requires one passed parameter.
Other require at least two valid parameters for correct operation.

Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
---
 drivers/power/power_core.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/power/power_core.c b/drivers/power/power_core.c
index 29ccc83..fe1f316 100644
--- a/drivers/power/power_core.c
+++ b/drivers/power/power_core.c
@@ -140,6 +140,9 @@ int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		return CMD_RET_SUCCESS;
 	}
 
+	if (argc < 3)
+		return CMD_RET_USAGE;
+
 	name = argv[1];
 	cmd = argv[2];
 
-- 
1.7.10.4



More information about the U-Boot mailing list