Skip to contentSkip to conversation

clk: zynqmp: Fixed the same if/else part error reported by coverity

PATCH New Vipul Kumar 2 participants 2 messages Jun 27, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: zynqmp: Fixed the same if/else part error reported by coverity

This patch fixed the same if/else part error by adding the required source select on the basis of is_pre_src check.

---
 drivers/clk/clk_zynqmp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/clk_zynqmp.c +4 -2
index a9e4500..167f3f7 100644
@@ -103,6 +103,8 @@ static const resource_size_t zynqmp_crl_apb_clkc_base = 0xff5e0020;
 #define PLLCTRL_BYPASS_SHFT    3
 #define PLLCTRL_POST_SRC_SHFT  24
 #define PLLCTRL_POST_SRC_MASK  (0x7 << PLLCTRL_POST_SRC_SHFT)
+#define PLLCTRL_PRE_SRC_SHFT   20
+#define PLLCTRL_PRE_SRC_MASK   (0x7 << PLLCTRL_PRE_SRC_SHFT)
 
 
 #define NUM_MIO_PINS   77
@@ -310,8 +312,8 @@ static ulong zynqmp_clk_get_pll_src(ulong clk_ctrl,
        u32 src_sel;
 
        if (is_pre_src)
-               src_sel = (clk_ctrl & PLLCTRL_POST_SRC_MASK) >>
-                          PLLCTRL_POST_SRC_SHFT;
+               src_sel = (clk_ctrl & PLLCTRL_PRE_SRC_MASK) >>
+                          PLLCTRL_PRE_SRC_SHFT;
        else
                src_sel = (clk_ctrl & PLLCTRL_POST_SRC_MASK) >>
                           PLLCTRL_POST_SRC_SHFT;

--
2.7.4

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

Applied
#1 lore raw

PATCH 1/1 clk: zynqmp: Fixed the same if/else part error reported by coverity

Quoted 23 lines · Vipul Kumar

This patch fixed the same if/else part error by adding the required source select on the basis of is_pre_src check.

---
 drivers/clk/clk_zynqmp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/clk_zynqmp.c +2 -0
index a9e4500..167f3f7 100644
@@ -103,6 +103,8 @@ static const resource_size_t zynqmp_crl_apb_clkc_base = 0xff5e0020;
 #define PLLCTRL_BYPASS_SHFT	3
 #define PLLCTRL_POST_SRC_SHFT	24
 #define PLLCTRL_POST_SRC_MASK	(0x7 << PLLCTRL_POST_SRC_SHFT)
+#define PLLCTRL_PRE_SRC_SHFT	20
+#define PLLCTRL_PRE_SRC_MASK	(0x7 << PLLCTRL_PRE_SRC_SHFT)
 
 
 #define NUM_MIO_PINS	77

drivers/clk/clk_zynqmp.c static ulong zynqmp_clk_get_pll_src(ulong clk_ctrl, · line 319

Quoted 10 lines
drivers/clk/clk_zynqmp.c +2 -2
@@ -310,8 +312,8 @@ static ulong zynqmp_clk_get_pll_src(ulong clk_ctrl,
 	u32 src_sel;
 
 	if (is_pre_src)
-		src_sel = (clk_ctrl & PLLCTRL_POST_SRC_MASK) >>
-			   PLLCTRL_POST_SRC_SHFT;
+		src_sel = (clk_ctrl & PLLCTRL_PRE_SRC_MASK) >>
+			   PLLCTRL_PRE_SRC_SHFT;
 	else
 		src_sel = (clk_ctrl & PLLCTRL_POST_SRC_MASK) >>
 			   PLLCTRL_POST_SRC_SHFT;

Applied.

Thanks,
Michal