aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/humidity/dht11.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/humidity/dht11.c')
-rw-r--r--drivers/iio/humidity/dht11.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/humidity/dht11.c b/drivers/iio/humidity/dht11.c
index 980cb946bbf7..e6579719a512 100644
--- a/drivers/iio/humidity/dht11.c
+++ b/drivers/iio/humidity/dht11.c
@@ -151,9 +151,9 @@ static int dht11_decode(struct dht11 *dht11, int offset)
dht11->temperature = (((temp_int & 0x7f) << 8) + temp_dec) *
((temp_int & 0x80) ? -100 : 100);
dht11->humidity = ((hum_int << 8) + hum_dec) * 100;
- } else if (temp_dec == 0 && hum_dec == 0) { /* DHT11 */
- dht11->temperature = temp_int * 1000;
- dht11->humidity = hum_int * 1000;
+ } else if (temp_dec < 10 && hum_dec < 10) { /* DHT11 */
+ dht11->temperature = temp_int * 1000 + temp_dec * 100;
+ dht11->humidity = hum_int * 1000 + hum_dec * 100;
} else {
dev_err(dht11->dev,
"Don't know how to decode data: %d %d %d %d\n",