]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
drivers: ddr: main.c: Fix Bad Shift operator issue
authorPriyanka Singh <priyanka.singh@nxp.com>
Thu, 19 Aug 2021 06:09:03 +0000 (11:39 +0530)
committerPriyanka Jain <priyanka.jain@nxp.com>
Tue, 9 Nov 2021 09:13:24 +0000 (14:43 +0530)
Fix Bad Shift operator issue in step_to_string function
by adding an if check

Signed-off-by: Priyanka Singh <priyanka.singh@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
drivers/ddr/fsl/main.c

index 8e147160b9fc4b2772154b9d91670adce15c8f6d..f389e5ef952417e55011e0edcffbd0f1f5d8265d 100644 (file)
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright 2008-2014 Freescale Semiconductor, Inc.
+ * Copyright 2021 NXP
  */
 
 /*
@@ -297,9 +298,13 @@ const char * step_to_string(unsigned int step) {
 
        unsigned int s = __ilog2(step);
 
-       if ((1 << s) != step)
-               return step_string_tbl[7];
-
+       if (s <= 31) {
+               if ((1 << s) != step)
+                       return step_string_tbl[7];
+       } else {
+               if ((1 << (s - 32)) != step)
+                       return step_string_tbl[7];
+       }
        if (s >= ARRAY_SIZE(step_string_tbl)) {
                printf("Error for the step in %s\n", __func__);
                s = 0;