From nobody@FreeBSD.org  Wed Mar 20 20:30:42 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 7B5E8931
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 20 Mar 2013 20:30:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 52020280
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 20 Mar 2013 20:30:42 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r2KKUf1E004977
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 20 Mar 2013 20:30:41 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r2KKUfQE004976;
	Wed, 20 Mar 2013 20:30:41 GMT
	(envelope-from nobody)
Message-Id: <201303202030.r2KKUfQE004976@red.freebsd.org>
Date: Wed, 20 Mar 2013 20:30:41 GMT
From: hiren panchasara <hiren.panchasara@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] Fixing clang warnings at /sys/dev/oce
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>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:  Wed Mar 20 20:50:00 UTC 2013
>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:

From: hiren panchasara <hiren.panchasara@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Cc: rizzo@iet.unipi.it
Subject: Re: kern/177156: [patch] Fixing clang warnings at /sys/dev/oce
Date: Wed, 20 Mar 2013 13:42:40 -0700

 + luigi to make sure that the fix is correct.
 
 On Wed, Mar 20, 2013 at 1:40 PM,  <FreeBSD-gnats-submit@freebsd.org> wrote:
 > Thank you very much for your problem report.
 > It has the internal identification `kern/177156'.
 > The individual assigned to look at your
 > report is: freebsd-bugs.
 >
 > You can access the state of your problem report at any time
 > via this link:
 >
 > http://www.freebsd.org/cgi/query-pr.cgi?pr=177156
 >
 >>Category:       kern
 >>Responsible:    freebsd-bugs
 >>Synopsis:       [patch] Fixing clang warnings at /sys/dev/oce
 >>Arrival-Date:   Wed Mar 20 20:40:00 UTC 2013
>Unformatted:
