<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27453">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Coverity: Fix CID1393970<br><br>Fix possible DIVIDE_BY_ZERO.<br><br>Change-Id: I5db6866b8e51eaea201a4c03e59d7d00f4f826e7<br>Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com><br>---<br>M src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c<br>1 file changed, 3 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/53/27453/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c</span><br><span>index eb2a85f..83ce563 100644</span><br><span>--- a/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c</span><br><span>+++ b/src/vendorcode/cavium/bdk/libbdk-hal/bdk-usb.c</span><br><span>@@ -369,7 +369,9 @@</span><br><span>             uint64_t fr_div;</span><br><span>             if (divider < 5) fr_div = divider * 2;</span><br><span>             else fr_div = 8 * (divider - 3);</span><br><span style="color: hsl(0, 100%, 40%);">-            uint64_t freq = (typeof(freq)) (sclk_rate / fr_div);</span><br><span style="color: hsl(120, 100%, 40%);">+            uint64_t freq = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+            if (fr_div > 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                freq = (typeof(freq)) (sclk_rate / fr_div);</span><br><span>             const char *token;</span><br><span>             if (freq < 62500000ULL) token = "???Low";</span><br><span>             else if (freq < 90000000ULL) token = "USB2";</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27453">change 27453</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/27453"/><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: I5db6866b8e51eaea201a4c03e59d7d00f4f826e7 </div>
<div style="display:none"> Gerrit-Change-Number: 27453 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com> </div>