Skip to contentSkip to conversation

soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv

PATCH Applied Gustavo A. R. Silva 3 participants 4 messages Jan 15, 2018 – Jan 16, 2018 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv

Currently clkoutdiv is being operated on by a logical && operator rather than a bitwise & operator. This looks incorrect as these should be bit flag operations.

Addresses-Coverity-ID: 1463959 ("Logical vs. bitwise operator")

Fixes cee8113a295a ("soc: xilinx: xlnx_vcu: Add Xilinx ZYNQMP VCU logicoreIP init driver")
---
 drivers/soc/xilinx/xlnx_vcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/xilinx/xlnx_vcu.c +1 -1
index c1d6f1b..a840c02 100644
@@ -334,7 +334,7 @@ static int xvcu_set_vcu_pll_info(struct xvcu_device *xvcu)
 	 */
 	vcu_pll_ctrl = xvcu_read(xvcu->vcu_slcr_ba, VCU_PLL_CTRL);
 	clkoutdiv = vcu_pll_ctrl >> VCU_PLL_CTRL_CLKOUTDIV_SHIFT;
-	clkoutdiv = clkoutdiv && VCU_PLL_CTRL_CLKOUTDIV_MASK;
+	clkoutdiv = clkoutdiv & VCU_PLL_CTRL_CLKOUTDIV_MASK;
 	if (clkoutdiv != 1) {
 		dev_err(xvcu->dev, "clkoutdiv value is invalid\n");
 		return -EINVAL;
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 34 lines

-----Original Message-----
From: Gustavo A. R. Silva [mailto:[email protected]]
Sent: Monday, January 15, 2018 11:15 AM
To: Michal Simek <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>
Cc: [email protected]; [email protected]; Gustavo A. R. Silva <[email protected]>
Subject: [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv

Currently clkoutdiv is being operated on by a logical && operator rather than a bitwise & operator. This looks incorrect as these should be bit flag operations.

Addresses-Coverity-ID: 1463959 ("Logical vs. bitwise operator")

Fixes cee8113a295a ("soc: xilinx: xlnx_vcu: Add Xilinx ZYNQMP VCU logicoreIP

init driver")

---
 drivers/soc/xilinx/xlnx_vcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/xilinx/xlnx_vcu.c index renamed from drivers/soc/xilinx/xlnx_vcu.c +0 -0

c1d6f1b..a840c02 100644

drivers/soc/xilinx/xlnx_vcu.c +1 -1
@@ -334,7 +334,7 @@ static int xvcu_set_vcu_pll_info(struct xvcu_device
 *xvcu)
 	 */
 	vcu_pll_ctrl = xvcu_read(xvcu->vcu_slcr_ba, VCU_PLL_CTRL);
 	clkoutdiv = vcu_pll_ctrl >> VCU_PLL_CTRL_CLKOUTDIV_SHIFT;
-	clkoutdiv = clkoutdiv && VCU_PLL_CTRL_CLKOUTDIV_MASK;
+	clkoutdiv = clkoutdiv & VCU_PLL_CTRL_CLKOUTDIV_MASK;
 	if (clkoutdiv != 1) {
 		dev_err(xvcu->dev, "clkoutdiv value is invalid\n");
Quoted 3 lines

return -EINVAL;
--
2.7.4

Thanks & Regards,
Dhaval

Applied
#2 lore raw
Quoted 33 lines · Dhaval Rajeshbhai Shah

Hi,

Quoted 31 lines

-----Original Message-----
From: Gustavo A. R. Silva [mailto:[email protected]]
Sent: Monday, January 15, 2018 11:15 AM
To: Michal Simek <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>
Cc: [email protected]; [email protected]; Gustavo A. R. Silva <[email protected]>
Subject: [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv

Currently clkoutdiv is being operated on by a logical && operator rather than a bitwise & operator. This looks incorrect as these should be bit flag operations.

Addresses-Coverity-ID: 1463959 ("Logical vs. bitwise operator")

Fixes cee8113a295a ("soc: xilinx: xlnx_vcu: Add Xilinx ZYNQMP VCU logicoreIP

init driver")

---
 drivers/soc/xilinx/xlnx_vcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/xilinx/xlnx_vcu.c index renamed from drivers/soc/xilinx/xlnx_vcu.c +0 -0

c1d6f1b..a840c02 100644

drivers/soc/xilinx/xlnx_vcu.c +0 -1
@@ -334,7 +334,7 @@ static int xvcu_set_vcu_pll_info(struct xvcu_device
 *xvcu)
  */
 vcu_pll_ctrl = xvcu_read(xvcu->vcu_slcr_ba, VCU_PLL_CTRL);
 clkoutdiv = vcu_pll_ctrl >> VCU_PLL_CTRL_CLKOUTDIV_SHIFT;
-clkoutdiv = clkoutdiv && VCU_PLL_CTRL_CLKOUTDIV_MASK;
Quoted 8 lines
Quoted 6 lines
drivers/soc/xilinx/xlnx_vcu.c +1 -0
+clkoutdiv = clkoutdiv & VCU_PLL_CTRL_CLKOUTDIV_MASK;
 if (clkoutdiv != 1) {
 dev_err(xvcu->dev, "clkoutdiv value is invalid\n");

return -EINVAL;
--
2.7.4

Applied.

Thanks,
Michal

#3 lore raw

Quoting Michal Simek <[email protected]>:

Quoted 43 lines · Dhaval Rajeshbhai Shah
Quoted 33 lines

Hi,

Quoted 31 lines

-----Original Message-----
From: Gustavo A. R. Silva [mailto:[email protected]]
Sent: Monday, January 15, 2018 11:15 AM
To: Michal Simek <[email protected]>; Dhaval Rajeshbhai Shah <[email protected]>
Cc: [email protected]; [email protected]; Gustavo A. R. Silva <[email protected]>
Subject: [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv

Currently clkoutdiv is being operated on by a logical && operator rather than a bitwise & operator. This looks incorrect as these should be bit flag operations.

Addresses-Coverity-ID: 1463959 ("Logical vs. bitwise operator")

Fixes cee8113a295a ("soc: xilinx: xlnx_vcu: Add Xilinx ZYNQMP VCU logicoreIP

init driver")

---
 drivers/soc/xilinx/xlnx_vcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/xilinx/xlnx_vcu.c index renamed from drivers/soc/xilinx/xlnx_vcu.c +0 -0

c1d6f1b..a840c02 100644

drivers/soc/xilinx/xlnx_vcu.c +0 -1
@@ -334,7 +334,7 @@ static int xvcu_set_vcu_pll_info(struct xvcu_device
 *xvcu)
  */
 vcu_pll_ctrl = xvcu_read(xvcu->vcu_slcr_ba, VCU_PLL_CTRL);
 clkoutdiv = vcu_pll_ctrl >> VCU_PLL_CTRL_CLKOUTDIV_SHIFT;
-clkoutdiv = clkoutdiv && VCU_PLL_CTRL_CLKOUTDIV_MASK;
Quoted 8 lines
Quoted 6 lines
drivers/soc/xilinx/xlnx_vcu.c +1 -0
+clkoutdiv = clkoutdiv & VCU_PLL_CTRL_CLKOUTDIV_MASK;
 if (clkoutdiv != 1) {
 dev_err(xvcu->dev, "clkoutdiv value is invalid\n");

return -EINVAL;
--
2.7.4

Quoted 4 lines

Applied.

Thanks,
Michal

Thank you guys.
--
Gustavo