[PATCH 1/1] board: freescale: vid.c: Add check for return value of adjust_vdd()

Priyanka Singh priyanka.singh at nxp.com
Mon Apr 19 07:45:04 CEST 2021


Add check for return value of adjust_vdd()

Signed-off-by: Biwen Li <biwen.li at nxp.com>
Signed-off-by: Priyanka Singh <priyanka.singh at nxp.com>
---
 board/freescale/common/vid.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c
index 6e8296293b..13ef101e7f 100644
--- a/board/freescale/common/vid.c
+++ b/board/freescale/common/vid.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
- * Copyright 2020 NXP
+ * Copyright 2020-21 NXP
  * Copyright 2020 Stephen Carlson <stcarlso at linux.microsoft.com>
  */
 
@@ -793,13 +793,16 @@ static int do_vdd_override(struct cmd_tbl *cmdtp,
 			   char *const argv[])
 {
 	ulong override;
+	int ret = 0;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
 
-	if (!strict_strtoul(argv[1], 10, &override))
-		adjust_vdd(override);   /* the value is checked by callee */
-	else
+	if (!strict_strtoul(argv[1], 10, &override)) {
+		ret = adjust_vdd(override);
+		if (ret < 0)
+			return CMD_RET_FAILURE;
+	} else
 		return CMD_RET_USAGE;
 	return 0;
 }
-- 
2.17.1



More information about the U-Boot mailing list