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,
5858 uint8_t dspsigl ;
5959
6060 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+ }
6265
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 ;
6870 }
6971
72+ drv_data -> temperature = (256 * (dspsigm & SIGN_BIT_MASK ))
73+ + dspsigl ;
74+
7075 LOG_DBG ("Sample_fetch retval: %d" , retval );
7176
7277 return retval ;
You can’t perform that action at this time.
0 commit comments