Zephyr NULL pointer checks

Hello,

In function such as i2c_write and i2c_read does Zephyr check to make sure the device is not a NULL pointer? If not how would it react if it were passed one?

Thanks,

Jacob

  • I haven't tested this, but I think -EIO (-5, ) will be returned

    When i2c_tranfer is called when you're using the driver \zephyr\drivers\i2c\i2c_nrfx_twim.c (which is the case if the compatible is set to "nordic,nrf-twim" in the i2c node) the following functions are called:

    • i2c_write() (\zephyr\include\zephyr\drivers\i2c.h)
    • i2c_transfer()  (\zephyr\include\zephyr\drivers\i2c.h)
    • i2c_nrfx_twim_transfer() (\zephyr\drivers\i2c\i2c_nrfx_twim.c)

    Please test this yourself and see if this is the case

    Best regards,

    Simon

Related