Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2013 22:30:22 GMT
From:      hiren panchasara <hiren.panchasara@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/177164: [patch] Fixing clang warnings at /sys/dev/ips
Message-ID:  <201303202230.r2KMUM9u002492@red.freebsd.org>
Resent-Message-ID: <201303202240.r2KMe01K005572@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         177164
>Category:       kern
>Synopsis:       [patch] Fixing clang warnings at /sys/dev/ips
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 20 22:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     hiren panchasara
>Release:        current
>Organization:
>Environment:
10.0-CURRENT FreeBSD 10.0-CURRENT #1 r248555: Wed Mar 20 15:00:20 UTC 2013
>Description:
===> ips (all)
/usr/src/sys/modules/ips/../../dev/ips/ips.c:582:13: warning: variable 'dmamap' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]   
        if (bus_dma_tag_create( /* parent    */ sc->adapter_dmatag,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/modules/ips/../../dev/ips/ips.c:626:44: note: uninitialized use occurs here
        bus_dmamem_free(dmatag, sc->copper_queue, dmamap);
                                                  ^~~~~~
/usr/src/sys/modules/ips/../../dev/ips/ips.c:582:9: note: remove the 'if' if its condition is always false
        if (bus_dma_tag_create( /* parent    */ sc->adapter_dmatag,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/modules/ips/../../dev/ips/ips.c:581:21: note: initialize the variable 'dmamap' to silence this warning
        bus_dmamap_t dmamap;
                           ^
                            = NULL
1 warning generated.

>How-To-Repeat:
cd /sys/modules/ips and do "make" to see clang warnings.
>Fix:
Index: sys/dev/ips/ips.c
===================================================================
--- sys/dev/ips/ips.c   (revision 248555)
+++ sys/dev/ips/ips.c   (working copy)
@@ -578,7 +578,7 @@
 {
        int error;
        bus_dma_tag_t dmatag;
-       bus_dmamap_t dmamap;
+       bus_dmamap_t dmamap = NULL;
                if (bus_dma_tag_create( /* parent    */ sc->adapter_dmatag,
                                /* alignemnt */ 1,
                                /* boundary  */ 0,

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303202230.r2KMUM9u002492>