kern/177156: [patch] Fixing clang warnings at /sys/dev/oce

hiren panchasara hiren.panchasara at gmail.com
Wed Mar 20 20:40:00 UTC 2013


>Number:         177156
>Category:       kern
>Synopsis:       [patch] Fixing clang warnings at /sys/dev/oce
>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 20: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:
===> oce (all)
/usr/src/sys/modules/oce/../../dev/oce/oce_mbox.c:1803:25: warning: comparison of constant 4095 with expression of type 'enum cq_len' is always false [-Wtautological-constant-out-of-range-compare]
                        if (cq->cq_cfg.q_len > (4*1024)-1)
                            ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~
1 warning generated.

Here q_len looks like this:

enum cq_len {
        CQ_LEN_256  = 256,
        CQ_LEN_512  = 512,
        CQ_LEN_1024 = 1024
};

>How-To-Repeat:
cd sys/modules/oce/ and do "make" to see clang warning.
>Fix:
Index: sys/dev/oce/oce_mbox.c
===================================================================
--- sys/dev/oce/oce_mbox.c      (revision 248555)
+++ sys/dev/oce/oce_mbox.c      (working copy)
@@ -1799,12 +1799,8 @@
                ctx->v2.coalesce_wm = ncoalesce;
                ctx->v2.armed = 0;
                ctx->v2.eq_id = cq->eq->eq_id;
-               if (ctx->v2.count == 3) {
-                       if (cq->cq_cfg.q_len > (4*1024)-1)
-                               ctx->v2.cqe_count = (4*1024)-1;
-                       else
-                               ctx->v2.cqe_count = cq->cq_cfg.q_len;
-               }
+               if (ctx->v2.count == 3)
+                       ctx->v2.cqe_count = cq->cq_cfg.q_len;
        } else {
                ctx->v0.num_pages = LE_16(num_pages);
                ctx->v0.eventable = is_eventable;


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


More information about the freebsd-bugs mailing list