staging: comedi: drivers: Do not use | with a variable with value 0
PATCH 1/1 staging: comedi: drivers: Do not use | with a variable with value 0
The variable events has a value equal to 0. There is no point combining it with other things with |. Semantic patch used:
@@
expression x, e, e1;
statement S;
@@
if(x == 0) {
... when != x = e1
when != while(...) S
when != for(...;...;...) S(
* x |= e
|
* x | e
)
... when any
}
Signed-off-by Janani Ravichandran <[email protected]>
--- drivers/staging/comedi/drivers/amplc_pci230.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/comedi/drivers/amplc_pci230.c +1 -1
@@ -1107,7 +1107,7 @@ static bool pci230_handle_ao_fifo(struct comedi_device *dev,/* Check for FIFO underrun. */ if (dacstat &PCI230P2_DAC_FIFO_UNDERRUN_LATCHED ) {dev_err (dev->class_dev,"AO FIFO underrun\n" ); - events |=COMEDI_CB_OVERFLOW |COMEDI_CB_ERROR ; + events =COMEDI_CB_OVERFLOW |COMEDI_CB_ERROR ; }/* * Check for buffer underrun if FIFO less than half full
Signature · 1 line
2.5.0
Quoted 29 lines · Janani Ravichandran
The variable events has a value equal to 0. There is no point combining it with other things with |. Semantic patch used:
@@
expression x, e, e1;
statement S;
@@if(x == 0) { ... when != x = e1 when != while(...) S when != for(...;...;...) S(
* x |= e
|
* x | e
)
... when any
}Signed-off-by Janani Ravichandran <[email protected]>--- drivers/staging/comedi/drivers/amplc_pci230.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/comedi/drivers/amplc_pci230.c +0
-0
drivers/staging/comedi/drivers/amplc_pci230.c static bool pci230_handle_ao_fifo(struct comedi_device *dev, · line 1110
Quoted 5 lines
drivers/staging/comedi/drivers/amplc_pci230.c +1
-1@@ -1107,7 +1107,7 @@ static bool pci230_handle_ao_fifo(struct comedi_device *dev,/* Check for FIFO underrun. */ if (dacstat &PCI230P2_DAC_FIFO_UNDERRUN_LATCHED ) {dev_err (dev->class_dev,"AO FIFO underrun\n" ); - events |=COMEDI_CB_OVERFLOW |COMEDI_CB_ERROR ; + events =COMEDI_CB_OVERFLOW |COMEDI_CB_ERROR ;
Maybe it's better as is, to keep the code simple and uniform.
julia
Quoted 13 lines
drivers/staging/comedi/drivers/amplc_pci230.c +0
-0}/* * Check for buffer underrun if FIFO less than half full Signature · 8 lines
2.5.0 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20160224005517.GA3677%40janani-Inspiron-3521. For more options, visit https://groups.google.com/d/optout.