Staging: comedi: logical || vs bitwise |
Subsystems (2)
PATCH 1/1 Staging: comedi: logical || vs bitwise |
These are bitfields and the intend was to OR them together. A logical OR here is simply 1.
Signed-off-by Dan Carpenter <[email protected]>
drivers/staging/comedi/drivers/dt9812.c +2 -2
@@ -527,7 +527,7 @@ static void dt9812_configure_gain(struct usb_dt9812 *dev,* 11x -> Gain = 0.5 */ case DT9812_GAIN_0PT5 : - rmw->or_value =F020_MASK_ADC0CF_AMP0GN2 || + rmw->or_value =F020_MASK_ADC0CF_AMP0GN2 |F020_MASK_ADC0CF_AMP0GN1 ;break ;case DT9812_GAIN_1 :
@@ -540,7 +540,7 @@ static void dt9812_configure_gain(struct usb_dt9812 *dev, rmw->or_value =F020_MASK_ADC0CF_AMP0GN1 ;break ;case DT9812_GAIN_8 : - rmw->or_value =F020_MASK_ADC0CF_AMP0GN1 || + rmw->or_value =F020_MASK_ADC0CF_AMP0GN1 |F020_MASK_ADC0CF_AMP0GN0 ;break ;case DT9812_GAIN_16 :
Quoted 4 lines · Dan Carpenter
These are bitfields and the intend was to OR them together. A logical OR here is simply 1.
Signed-off-by Dan Carpenter<[email protected]>
You have my ack. I'll just add that since the driver is incomplete, the buggy code is not currently reached. (In fact, as the AI and AO subdevices have neither a range_table nor a range_table_list, the comedi core's COMEDI_INSN/COMEDI_INSNLIST ioctl handlers will return an error for these subdevices before it even calls the driver's insn handlers for these subdevices!)
Acked-by Ian Abbott <[email protected]>
Signature · 2 lines
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-