linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][i3c-next] i3c: master: fix mask operation by using the correct operator
@ 2018-11-16 18:42 Colin King
  2018-11-19 12:41 ` vitor
  0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2018-11-16 18:42 UTC (permalink / raw)
  To: Vitor Soares, Boris Brezillon; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The masking operation on status is using a bitwise 'or' rather than
a bitwise 'and' operator, and hence the result is always non-zero
which is probably not what is intended. Fix this by using the correct
operator.

Detected by CoverityScan, CID#1475523 ("Wrong operator used")

Fixes: 88acc98a712a ("i3c: master: Add driver for Synopsys DesignWare IP")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/i3c/master/dw-i3c-master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index 0153e6e9de52..b532e2c9cf5c 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1085,7 +1085,7 @@ static irqreturn_t dw_i3c_master_irq_handler(int irq, void *dev_id)
 
 	spin_lock(&master->xferqueue.lock);
 	dw_i3c_master_end_xfer_locked(master, status);
-	if (status | INTR_TRANSFER_ERR_STAT)
+	if (status & INTR_TRANSFER_ERR_STAT)
 		writel(INTR_TRANSFER_ERR_STAT, master->regs + INTR_STATUS);
 	spin_unlock(&master->xferqueue.lock);
 
-- 
2.19.1


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

* Re: [PATCH][i3c-next] i3c: master: fix mask operation by using the correct operator
  2018-11-16 18:42 [PATCH][i3c-next] i3c: master: fix mask operation by using the correct operator Colin King
@ 2018-11-19 12:41 ` vitor
  2018-11-19 16:49   ` Boris Brezillon
  0 siblings, 1 reply; 3+ messages in thread
From: vitor @ 2018-11-19 12:41 UTC (permalink / raw)
  To: Colin King, Vitor Soares, Boris Brezillon; +Cc: kernel-janitors, linux-kernel

Hi Coling,


Thanks for your report.

On 16/11/18 18:42, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The masking operation on status is using a bitwise 'or' rather than
> a bitwise 'and' operator, and hence the result is always non-zero
> which is probably not what is intended. Fix this by using the correct
> operator.
>
> Detected by CoverityScan, CID#1475523 ("Wrong operator used")
>
> Fixes: 88acc98a712a ("i3c: master: Add driver for Synopsys DesignWare IP")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   drivers/i3c/master/dw-i3c-master.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 0153e6e9de52..b532e2c9cf5c 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1085,7 +1085,7 @@ static irqreturn_t dw_i3c_master_irq_handler(int irq, void *dev_id)
>   
>   	spin_lock(&master->xferqueue.lock);
>   	dw_i3c_master_end_xfer_locked(master, status);
> -	if (status | INTR_TRANSFER_ERR_STAT)
> +	if (status & INTR_TRANSFER_ERR_STAT)
>   		writel(INTR_TRANSFER_ERR_STAT, master->regs + INTR_STATUS);
>   	spin_unlock(&master->xferqueue.lock);
>   
Acked-by: Vitor Soares <vitor.soares@synopsys.com>

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

* Re: [PATCH][i3c-next] i3c: master: fix mask operation by using the correct operator
  2018-11-19 12:41 ` vitor
@ 2018-11-19 16:49   ` Boris Brezillon
  0 siblings, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2018-11-19 16:49 UTC (permalink / raw)
  To: vitor; +Cc: Colin King, kernel-janitors, linux-kernel

On Mon, 19 Nov 2018 12:41:10 +0000
vitor <vitor.soares@synopsys.com> wrote:

> Hi Coling,
> 
> 
> Thanks for your report.
> 
> On 16/11/18 18:42, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > The masking operation on status is using a bitwise 'or' rather than
> > a bitwise 'and' operator, and hence the result is always non-zero
> > which is probably not what is intended. Fix this by using the correct
> > operator.
> >
> > Detected by CoverityScan, CID#1475523 ("Wrong operator used")
> >
> > Fixes: 88acc98a712a ("i3c: master: Add driver for Synopsys DesignWare IP")
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >   drivers/i3c/master/dw-i3c-master.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> > index 0153e6e9de52..b532e2c9cf5c 100644
> > --- a/drivers/i3c/master/dw-i3c-master.c
> > +++ b/drivers/i3c/master/dw-i3c-master.c
> > @@ -1085,7 +1085,7 @@ static irqreturn_t dw_i3c_master_irq_handler(int irq, void *dev_id)
> >   
> >   	spin_lock(&master->xferqueue.lock);
> >   	dw_i3c_master_end_xfer_locked(master, status);
> > -	if (status | INTR_TRANSFER_ERR_STAT)
> > +	if (status & INTR_TRANSFER_ERR_STAT)
> >   		writel(INTR_TRANSFER_ERR_STAT, master->regs + INTR_STATUS);
> >   	spin_unlock(&master->xferqueue.lock);
> >     
> Acked-by: Vitor Soares <vitor.soares@synopsys.com>

Applied.

Thanks,

Boris

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

end of thread, other threads:[~2018-11-19 17:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-16 18:42 [PATCH][i3c-next] i3c: master: fix mask operation by using the correct operator Colin King
2018-11-19 12:41 ` vitor
2018-11-19 16:49   ` Boris Brezillon

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).