* [PATCH] mei: fix incorrect logical operator in if statement
@ 2017-12-19 17:35 Colin King
2017-12-20 8:58 ` Winkler, Tomas
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-12-19 17:35 UTC (permalink / raw)
To: Tomas Winkler, Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The current expression using the || operator is always true because
dev->dev_state cannot be equal to two different values at the same time.
Fix this by replacing the || with &&.
Detected by CoverityScan, CID#1463042 ("Constant expression result")
Fixes: 8d52af6795c0 ("mei: speed up the power down flow")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/misc/mei/hw-me.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 0b21f9ec00f5..334ab02e1de2 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -1261,7 +1261,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
break;
if (rets &&
- (dev->dev_state != MEI_DEV_RESETTING ||
+ (dev->dev_state != MEI_DEV_RESETTING &&
dev->dev_state != MEI_DEV_POWER_DOWN)) {
dev_err(dev->dev, "mei_irq_read_handler ret = %d.\n",
rets);
--
2.14.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mei: fix incorrect logical operator in if statement
2017-12-19 17:35 [PATCH] mei: fix incorrect logical operator in if statement Colin King
@ 2017-12-20 8:58 ` Winkler, Tomas
2017-12-20 9:10 ` Colin Ian King
0 siblings, 1 reply; 3+ messages in thread
From: Winkler, Tomas @ 2017-12-20 8:58 UTC (permalink / raw)
To: Colin King, Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel-janitors, linux-kernel
> From: Colin Ian King <colin.king@canonical.com>
>
> The current expression using the || operator is always true because
> dev->dev_state cannot be equal to two different values at the same time.
> Fix this by replacing the || with &&.
>
> Detected by CoverityScan, CID#1463042 ("Constant expression result")
>
> Fixes: 8d52af6795c0 ("mei: speed up the power down flow")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Shame on me.
Ack.
Tomas
> ---
> drivers/misc/mei/hw-me.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index
> 0b21f9ec00f5..334ab02e1de2 100644
> --- a/drivers/misc/mei/hw-me.c
> +++ b/drivers/misc/mei/hw-me.c
> @@ -1261,7 +1261,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq,
> void *dev_id)
> break;
>
> if (rets &&
> - (dev->dev_state != MEI_DEV_RESETTING ||
> + (dev->dev_state != MEI_DEV_RESETTING &&
> dev->dev_state != MEI_DEV_POWER_DOWN)) {
> dev_err(dev->dev, "mei_irq_read_handler ret =
> %d.\n",
> rets);
> --
> 2.14.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mei: fix incorrect logical operator in if statement
2017-12-20 8:58 ` Winkler, Tomas
@ 2017-12-20 9:10 ` Colin Ian King
0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2017-12-20 9:10 UTC (permalink / raw)
To: Winkler, Tomas, Arnd Bergmann, Greg Kroah-Hartman
Cc: kernel-janitors, linux-kernel
On 20/12/17 08:58, Winkler, Tomas wrote:
>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> The current expression using the || operator is always true because
>> dev->dev_state cannot be equal to two different values at the same time.
>> Fix this by replacing the || with &&.
>>
>> Detected by CoverityScan, CID#1463042 ("Constant expression result")
>>
>> Fixes: 8d52af6795c0 ("mei: speed up the power down flow")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Shame on me.
No worries, that's why I run static analysis linux-next.
> Ack.
> Tomas
>
>> ---
>> drivers/misc/mei/hw-me.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index
>> 0b21f9ec00f5..334ab02e1de2 100644
>> --- a/drivers/misc/mei/hw-me.c
>> +++ b/drivers/misc/mei/hw-me.c
>> @@ -1261,7 +1261,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq,
>> void *dev_id)
>> break;
>>
>> if (rets &&
>> - (dev->dev_state != MEI_DEV_RESETTING ||
>> + (dev->dev_state != MEI_DEV_RESETTING &&
>> dev->dev_state != MEI_DEV_POWER_DOWN)) {
>> dev_err(dev->dev, "mei_irq_read_handler ret =
>> %d.\n",
>> rets);
>> --
>> 2.14.1
>
> N�����r��y���b�X��ǧv�^�){.n�+���z�ޖ6���+�)���w*\x1fjg���\x1e�����ݢj/���z�ޖ��2�ޙ���&�)ߡ�a��\x7f��\x1e�G���h�\x0f�j:+v���w�٥
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-12-20 9:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 17:35 [PATCH] mei: fix incorrect logical operator in if statement Colin King
2017-12-20 8:58 ` Winkler, Tomas
2017-12-20 9:10 ` Colin Ian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®