<p>Patrick Rudolph has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/27450">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Coverity: Fix CID1393974<br><br>Fix OVERFLOW_BEFORE_WIDEN.<br><br>Change-Id: I39caea8a248d2f1debfca307f6fb7a2fe3e431b1<br>Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com><br>---<br>M src/soc/cavium/cn81xx/gpio.c<br>1 file changed, 8 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/27450/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/cavium/cn81xx/gpio.c b/src/soc/cavium/cn81xx/gpio.c</span><br><span>index 340ac1b..84e36d1 100644</span><br><span>--- a/src/soc/cavium/cn81xx/gpio.c</span><br><span>+++ b/src/soc/cavium/cn81xx/gpio.c</span><br><span>@@ -103,9 +103,9 @@</span><br><span>        printk(BIOS_SPEW, "GPIO(%u): level: %u\n", gpio, !!value);</span><br><span> </span><br><span>     if (value)</span><br><span style="color: hsl(0, 100%, 40%);">-              write64(&regs->tx_set, 1 << gpio);</span><br><span style="color: hsl(120, 100%, 40%);">+               write64(&regs->tx_set, 1ULL << gpio);</span><br><span>   else</span><br><span style="color: hsl(0, 100%, 40%);">-            write64(&regs->tx_clr, 1 << gpio);</span><br><span style="color: hsl(120, 100%, 40%);">+               write64(&regs->tx_clr, 1ULL << gpio);</span><br><span> }</span><br><span> </span><br><span> /* Set GPIO direction to OUTPUT with level */</span><br><span>@@ -153,9 +153,10 @@</span><br><span>          return 0;</span><br><span> </span><br><span>        const u64 reg = read64(&regs->rx_dat);</span><br><span style="color: hsl(0, 100%, 40%);">-   printk(BIOS_SPEW, "GPIO(%u): input: %u\n", gpio, !!(reg & (1 << gpio)));</span><br><span style="color: hsl(120, 100%, 40%);">+  printk(BIOS_SPEW, "GPIO(%u): input: %u\n", gpio,</span><br><span style="color: hsl(120, 100%, 40%);">+           !!(reg & (1ULL << gpio)));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return !!(reg & (1 << gpio));</span><br><span style="color: hsl(120, 100%, 40%);">+       return !!(reg & (1ULL << gpio));</span><br><span> }</span><br><span> </span><br><span> /* Read GPIO STRAP level sampled at cold boot */</span><br><span>@@ -167,9 +168,10 @@</span><br><span>               return 0;</span><br><span> </span><br><span>        const u64 reg = read64(&regs->strap);</span><br><span style="color: hsl(0, 100%, 40%);">-    printk(BIOS_SPEW, "GPIO(%u): strap: %u\n", gpio, !!(reg & (1 << gpio)));</span><br><span style="color: hsl(120, 100%, 40%);">+  printk(BIOS_SPEW, "GPIO(%u): strap: %u\n", gpio,</span><br><span style="color: hsl(120, 100%, 40%);">+           !!(reg & (1ULL << gpio)));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return !!(reg & (1 << gpio));</span><br><span style="color: hsl(120, 100%, 40%);">+       return !!(reg & (1ULL << gpio));</span><br><span> }</span><br><span> </span><br><span> /* FIXME: Parse devicetree ? */</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/27450">change 27450</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/27450"/><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: I39caea8a248d2f1debfca307f6fb7a2fe3e431b1 </div>
<div style="display:none"> Gerrit-Change-Number: 27450 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Patrick Rudolph <patrick.rudolph@9elements.com> </div>