<p>Furquan Shaikh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27207">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">drivers/i2c/sx9310: Check for config not being NULL before using it<br><br>This change fixes the issue reported by Coverity CID 1393576 to ensure<br>that config is checked for NULL before it is actually used.<br><br>Change-Id: I5f0cd2bf2437fc640f4cf8d8203a971daf1f8d17<br>Signed-off-by: Furquan Shaikh <furquan@google.com><br>---<br>M src/drivers/i2c/sx9310/sx9310.c<br>1 file changed, 4 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/27207/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/drivers/i2c/sx9310/sx9310.c b/src/drivers/i2c/sx9310/sx9310.c</span><br><span>index 7da87c4..5f63734 100644</span><br><span>--- a/src/drivers/i2c/sx9310/sx9310.c</span><br><span>+++ b/src/drivers/i2c/sx9310/sx9310.c</span><br><span>@@ -36,7 +36,7 @@</span><br><span>     struct acpi_i2c i2c = {</span><br><span>              .address = dev->path.i2c.device,</span><br><span>          .mode_10bit = dev->path.i2c.mode_10bit,</span><br><span style="color: hsl(0, 100%, 40%);">-              .speed = config->speed ? : I2C_SPEED_FAST,</span><br><span style="color: hsl(120, 100%, 40%);">+         .speed = I2C_SPEED_FAST,</span><br><span>             .resource = scope,</span><br><span>   };</span><br><span>   struct acpi_dp *dsd;</span><br><span>@@ -44,6 +44,9 @@</span><br><span>     if (!dev->enabled || !scope || !config)</span><br><span>           return;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   if (config->speed)</span><br><span style="color: hsl(120, 100%, 40%);">+         i2c.speed = config->speed;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      /* Device */</span><br><span>         acpigen_write_scope(scope);</span><br><span>  acpigen_write_device(acpi_device_name(dev));</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27207">change 27207</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/27207"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I5f0cd2bf2437fc640f4cf8d8203a971daf1f8d17 </div>
<div style="display:none"> Gerrit-Change-Number: 27207 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Furquan Shaikh <furquan@google.com> </div>