dt9812: Fix logical || vs bitwise |.
authorIan Abbott <abbotti@mev.co.uk>
Tue, 17 Jan 2012 10:13:59 +0000 (10:13 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Tue, 17 Jan 2012 10:13:59 +0000 (10:13 +0000)
Fix bug discovered by Dan Carpenter in the "staging" sources.

In dt9212_configure_gain(), some bitmask constants were OR'ed together
logically (giving the value 1) when they should have been OR'ed together
bitwise.  The effect of this bug is that the analog gain would be set
incorrectly on the AI subdevice for certain ranges.

As it happens, the driver is incomplete regarding range settings anyway,
so the bug fix currently has no effect.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
comedi/drivers/dt9812.c

index 226619e1da5dde881118f7626aaf1e1d6a8a72c3..d91d33ba160066f0af43139f4c1595370654962b 100644 (file)
@@ -305,7 +305,7 @@ static void dt9812_configure_gain(usb_dt9812_t * dev,
                // 11x -> Gain =  0.5 
        case DT9812_GAIN_0PT5:{
                        rmw->or_value = F020_MASK_ADC0CF_AMP0GN2
-                               || F020_MASK_ADC0CF_AMP0GN1;
+                               | F020_MASK_ADC0CF_AMP0GN1;
                }
                break;
        case DT9812_GAIN_1:{
@@ -322,7 +322,7 @@ static void dt9812_configure_gain(usb_dt9812_t * dev,
                break;
        case DT9812_GAIN_8:{
                        rmw->or_value = F020_MASK_ADC0CF_AMP0GN1
-                               || F020_MASK_ADC0CF_AMP0GN0;
+                               | F020_MASK_ADC0CF_AMP0GN0;
                }
                break;
        case DT9812_GAIN_16:{