<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Zephyr NULL pointer checks</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89640/zephyr-null-pointer-checks</link><description>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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 05 Jul 2022 15:07:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89640/zephyr-null-pointer-checks" /><item><title>RE: Zephyr NULL pointer checks</title><link>https://devzone.nordicsemi.com/thread/375607?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 15:07:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56891a20-5fa1-4bca-87a3-312d9ff09904</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I haven&amp;#39;t tested this, but I think -EIO (-5, ) will be returned&lt;/p&gt;
&lt;p&gt;When i2c_tranfer is called when you&amp;#39;re using the&amp;nbsp;driver&amp;nbsp;\zephyr\drivers\i2c\i2c_nrfx_twim.c (which is the case if the compatible is set to&amp;nbsp;&lt;span&gt;&amp;quot;nordic,nrf-twim&amp;quot; in the i2c node&lt;/span&gt;) the following functions are called:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;i2c_write() (\zephyr\include\zephyr\drivers\i2c.h)&lt;/li&gt;
&lt;li&gt;i2c_transfer()&amp;nbsp;&amp;nbsp;(\zephyr\include\zephyr\drivers\i2c.h)&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;i2c_nrfx_twim_transfer() (\zephyr\drivers\i2c\i2c_nrfx_twim.c)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v3.0.99-ncs1/drivers/i2c/i2c_nrfx_twim.c#L59"&gt;-EIO is returned&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please test this yourself and see if this is the case&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>