linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv
@ 2018-01-15 19:15 Gustavo A. R. Silva
  2018-01-16 14:22 ` Dhaval Rajeshbhai Shah
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-01-15 19:15 UTC (permalink / raw)
  To: Michal Simek, Dhaval Shah
  Cc: linux-arm-kernel, linux-kernel, Gustavo A. R. Silva

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")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/soc/xilinx/xlnx_vcu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/xilinx/xlnx_vcu.c b/drivers/soc/xilinx/xlnx_vcu.c
index c1d6f1b..a840c02 100644
--- a/drivers/soc/xilinx/xlnx_vcu.c
+++ b/drivers/soc/xilinx/xlnx_vcu.c
@@ -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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv
  2018-01-15 19:15 [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv Gustavo A. R. Silva
@ 2018-01-16 14:22 ` Dhaval Rajeshbhai Shah
  2018-01-16 14:50   ` Michal Simek
  0 siblings, 1 reply; 4+ messages in thread
From: Dhaval Rajeshbhai Shah @ 2018-01-16 14:22 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Michal Simek; +Cc: linux-arm-kernel, linux-kernel

Hi,

> -----Original Message-----
> From: Gustavo A. R. Silva [mailto:garsilva@embeddedor.com]
> Sent: Monday, January 15, 2018 11:15 AM
> To: Michal Simek <michal.simek@xilinx.com>; Dhaval Rajeshbhai Shah
> <DSHAH@xilinx.com>
> Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
> Gustavo A. R. Silva <garsilva@embeddedor.com>
> 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")
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
>  drivers/soc/xilinx/xlnx_vcu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/xilinx/xlnx_vcu.c b/drivers/soc/xilinx/xlnx_vcu.c index
> c1d6f1b..a840c02 100644
> --- a/drivers/soc/xilinx/xlnx_vcu.c
> +++ b/drivers/soc/xilinx/xlnx_vcu.c
> @@ -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;
> --
> 2.7.4

Acked-by: Dhaval Shah <dshah@xilinx.com>

Thanks & Regards,
Dhaval

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv
  2018-01-16 14:22 ` Dhaval Rajeshbhai Shah
@ 2018-01-16 14:50   ` Michal Simek
  2018-01-16 17:04     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Simek @ 2018-01-16 14:50 UTC (permalink / raw)
  To: Dhaval Rajeshbhai Shah, Gustavo A. R. Silva, Michal Simek
  Cc: linux-arm-kernel, linux-kernel

On 16.1.2018 15:22, Dhaval Rajeshbhai Shah wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Gustavo A. R. Silva [mailto:garsilva@embeddedor.com]
>> Sent: Monday, January 15, 2018 11:15 AM
>> To: Michal Simek <michal.simek@xilinx.com>; Dhaval Rajeshbhai Shah
>> <DSHAH@xilinx.com>
>> Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
>> Gustavo A. R. Silva <garsilva@embeddedor.com>
>> 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")
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>> ---
>>  drivers/soc/xilinx/xlnx_vcu.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/soc/xilinx/xlnx_vcu.c b/drivers/soc/xilinx/xlnx_vcu.c index
>> c1d6f1b..a840c02 100644
>> --- a/drivers/soc/xilinx/xlnx_vcu.c
>> +++ b/drivers/soc/xilinx/xlnx_vcu.c
>> @@ -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;
>> --
>> 2.7.4
> 
> Acked-by: Dhaval Shah <dshah@xilinx.com>

Applied.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv
  2018-01-16 14:50   ` Michal Simek
@ 2018-01-16 17:04     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-01-16 17:04 UTC (permalink / raw)
  To: Michal Simek; +Cc: Dhaval Rajeshbhai Shah, linux-arm-kernel, linux-kernel


Quoting Michal Simek <michal.simek@xilinx.com>:

> On 16.1.2018 15:22, Dhaval Rajeshbhai Shah wrote:
>> Hi,
>>
>>> -----Original Message-----
>>> From: Gustavo A. R. Silva [mailto:garsilva@embeddedor.com]
>>> Sent: Monday, January 15, 2018 11:15 AM
>>> To: Michal Simek <michal.simek@xilinx.com>; Dhaval Rajeshbhai Shah
>>> <DSHAH@xilinx.com>
>>> Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org;
>>> Gustavo A. R. Silva <garsilva@embeddedor.com>
>>> 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")
>>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>>> ---
>>>  drivers/soc/xilinx/xlnx_vcu.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/soc/xilinx/xlnx_vcu.c  
>>> b/drivers/soc/xilinx/xlnx_vcu.c index
>>> c1d6f1b..a840c02 100644
>>> --- a/drivers/soc/xilinx/xlnx_vcu.c
>>> +++ b/drivers/soc/xilinx/xlnx_vcu.c
>>> @@ -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;
>>> --
>>> 2.7.4
>>
>> Acked-by: Dhaval Shah <dshah@xilinx.com>
>
> Applied.
>
> Thanks,
> Michal

Thank you guys.
--
Gustavo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-16 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 19:15 [PATCH] soc: xilinx: xlnx_vcu: Use bitwise & rather than logical && on clkoutdiv Gustavo A. R. Silva
2018-01-16 14:22 ` Dhaval Rajeshbhai Shah
2018-01-16 14:50   ` Michal Simek
2018-01-16 17:04     ` Gustavo A. R. Silva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).