File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
drivers/sensor/silabs/si7060 Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -58,15 +58,20 @@ static int si7060_sample_fetch(const struct device *dev,
58
58
uint8_t dspsigl ;
59
59
60
60
retval = si7060_reg_read (dev , SI7060_REG_TEMP_HIGH , & dspsigm );
61
- retval += si7060_reg_read (dev , SI7060_REG_TEMP_LOW , & dspsigl );
61
+ if (retval != 0 ) {
62
+ LOG_ERR ("Error reading temperature high register" );
63
+ return retval ;
64
+ }
62
65
63
- if (retval == 0 ) {
64
- drv_data -> temperature = (256 * (dspsigm & SIGN_BIT_MASK ))
65
- + dspsigl ;
66
- } else {
67
- LOG_ERR ("Read register err" );
66
+ retval = si7060_reg_read (dev , SI7060_REG_TEMP_LOW , & dspsigl );
67
+ if (retval != 0 ) {
68
+ LOG_ERR ("Error reading temperature low register" );
69
+ return retval ;
68
70
}
69
71
72
+ drv_data -> temperature = (256 * (dspsigm & SIGN_BIT_MASK ))
73
+ + dspsigl ;
74
+
70
75
LOG_DBG ("Sample_fetch retval: %d" , retval );
71
76
72
77
return retval ;
You can’t perform that action at this time.
0 commit comments