File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,10 @@ static int apds9306_sensor_setup(const struct device *dev)
271271 /* Wait for the device to become ready after a possible power cycle. */
272272 now = k_uptime_get_32 ();
273273 do {
274- i2c_reg_read_byte_dt (& config -> i2c , APDS9306_REGISTER_MAIN_STATUS , & temp );
274+ if (i2c_reg_read_byte_dt (& config -> i2c , APDS9306_REGISTER_MAIN_STATUS , & temp )) {
275+ LOG_ERR ("Failed reading sensor status!" );
276+ return - EFAULT ;
277+ }
275278
276279 /* We wait 100 ms maximum for the device to become ready. */
277280 if ((k_uptime_get_32 () - now ) > 100 ) {
@@ -308,7 +311,10 @@ static int apds9306_sensor_setup(const struct device *dev)
308311
309312 /* Perform a dummy read to avoid bus errors after the reset. See */
310313 /* https://lore.kernel.org/lkml/[email protected] / */ 311- i2c_reg_read_byte_dt (& config -> i2c , APDS9306_REGISTER_PART_ID , & temp );
314+ if (i2c_reg_read_byte_dt (& config -> i2c , APDS9306_REGISTER_PART_ID , & temp )) {
315+ LOG_ERR ("Failed reading chip id!" );
316+ return - EFAULT ;
317+ }
312318
313319 return 0 ;
314320}
You can’t perform that action at this time.
0 commit comments