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)
271
271
/* Wait for the device to become ready after a possible power cycle. */
272
272
now = k_uptime_get_32 ();
273
273
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
+ }
275
278
276
279
/* We wait 100 ms maximum for the device to become ready. */
277
280
if ((k_uptime_get_32 () - now ) > 100 ) {
@@ -308,7 +311,10 @@ static int apds9306_sensor_setup(const struct device *dev)
308
311
309
312
/* Perform a dummy read to avoid bus errors after the reset. See */
310
313
/* 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
+ }
312
318
313
319
return 0 ;
314
320
}
You can’t perform that action at this time.
0 commit comments