From 71b255b6575b8e859ffddc880cce3c7606c7abca Mon Sep 17 00:00:00 2001 From: Priyanka Singh Date: Thu, 19 Aug 2021 11:39:03 +0530 Subject: 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 Reviewed-by: Priyanka Jain --- drivers/ddr/fsl/main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ddr/fsl/main.c b/drivers/ddr/fsl/main.c index 8e147160b9f..f389e5ef952 100644 --- a/drivers/ddr/fsl/main.c +++ b/drivers/ddr/fsl/main.c @@ -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; -- cgit v1.2.3