diff mbox

[U-Boot,5/6] bzlib: Try another way to fix an unused variable

Message ID 1454193919-27264-5-git-send-email-sjg@chromium.org
State Accepted
Commit 512cab7e8e7d3a2ae0e8c2b70c33c349fcb6bcb9
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Simon Glass Jan. 30, 2016, 10:45 p.m. UTC
Use __maybe_unused which should avoid the Coverity error.

Reported-by: Coverity (CID: 134900)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 lib/bzip2/bzlib_compress.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Tom Rini Feb. 1, 2016, 4:54 p.m. UTC | #1
On Sat, Jan 30, 2016 at 03:45:18PM -0700, Simon Glass wrote:

> Use __maybe_unused which should avoid the Coverity error.
> 
> Reported-by: Coverity (CID: 134900)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Tom Rini <trini@konsulko.com>
Anatolij Gustschin Feb. 6, 2016, 1:12 p.m. UTC | #2
On Sat, 30 Jan 2016 15:45:18 -0700
Simon Glass sjg@chromium.org wrote:

> Use __maybe_unused which should avoid the Coverity error.
> 
> Reported-by: Coverity (CID: 134900)
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  lib/bzip2/bzlib_compress.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

applied to u-boot-staging, thanks!

--
Anatolij
diff mbox

Patch

diff --git a/lib/bzip2/bzlib_compress.c b/lib/bzip2/bzlib_compress.c
index c8da1c7..68d948b 100644
--- a/lib/bzip2/bzlib_compress.c
+++ b/lib/bzip2/bzlib_compress.c
@@ -67,7 +67,7 @@ 
 */
 
 #include "bzlib_private.h"
-
+#include <compiler.h>
 
 /*---------------------------------------------------*/
 /*--- Bit stream I/O                              ---*/
@@ -280,7 +280,8 @@  void sendMTFValues ( EState* s )
 {
    Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
    Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
-   Int32 nGroups, nBytes;
+   Int32 nGroups;
+   Int32 nBytes __maybe_unused;
 
    /*--
    UChar  len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
@@ -635,8 +636,6 @@  void sendMTFValues ( EState* s )
 
    if (s->verbosity >= 3)
       VPrintf1( "codes %d\n", s->numZ-nBytes );
-   else /* squash compiler 'used but not set' warning */
-      nBytes = nBytes;
 }