]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: freescale: vid.c: Add check for return value of adjust_vdd()
authorPriyanka Singh <priyanka.singh@nxp.com>
Mon, 19 Apr 2021 05:45:04 +0000 (11:15 +0530)
committerPriyanka Jain <priyanka.jain@nxp.com>
Thu, 17 Jun 2021 06:16:11 +0000 (11:46 +0530)
Add check for return value of adjust_vdd()

Signed-off-by: Biwen Li <biwen.li@nxp.com>
Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
board/freescale/common/vid.c

index 6e8296293b89fe276dd89bf9a636d1b1faba5c33..13ef101e7fb0a0b50e5bcb7286209cd7b7e9e511 100644 (file)
@@ -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@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;
 }