mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
drivers: ddr: main.c: Fix Bad Shift operator issue
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>
This commit is contained in:
parent
f5a37b02b0
commit
71b255b657
1 changed files with 8 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue