Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Apr 2012 18:21:45 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r234736 - stable/9/sys/contrib/rdma
Message-ID:  <201204271821.q3RILjES018663@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Fri Apr 27 18:21:45 2012
New Revision: 234736
URL: http://svn.freebsd.org/changeset/base/234736

Log:
  MFC r234507:
  
  Fix the following compilation warnings in sys/contrib/rdma/rdma_cma.c:
  
    sys/contrib/rdma/rdma_cma.c:1259:8: error: case value not in enumerated type 'enum iw_cm_event_status' [-Werror,-Wswitch]
  	    case ECONNRESET:
  		 ^
    @/sys/errno.h:118:20: note: expanded from macro 'ECONNRESET'
    #define ECONNRESET      54              /* Connection reset by peer */
  		    ^
    sys/contrib/rdma/rdma_cma.c:1263:8: error: case value not in enumerated type 'enum iw_cm_event_status' [-Werror,-Wswitch]
  	    case ETIMEDOUT:
  		 ^
    @/sys/errno.h:124:19: note: expanded from macro 'ETIMEDOUT'
    #define ETIMEDOUT       60              /* Operation timed out */
  		    ^
    sys/contrib/rdma/rdma_cma.c:1260:8: error: case value not in enumerated type 'enum iw_cm_event_status' [-Werror,-Wswitch]
  	    case ECONNREFUSED:
  		 ^
    @/sys/errno.h:125:22: note: expanded from macro 'ECONNREFUSED'
    #define ECONNREFUSED    61              /* Connection refused */
  		    ^
  
  This is because the switch uses iw_cm_event::status, which is an enum
  iw_cm_event_status, while ECONNRESET, ETIMEDOUT and ECONNREFUSED are
  just plain defines from errno.h.
  
  It looks like there is only one use of any of the enumeration values of
  iw_cm_event_status, in:
  
    sys/contrib/rdma/rdma_iwcm.c:       if (iw_event->status == IW_CM_EVENT_STATUS_ACCEPTED) {
  
  So messing around with the enum definitions to fix the warning seems too
  disruptive; the simplest fix is to cast the argument of the switch to
  int.
  
  Reviewed by:	kmacy

Modified:
  stable/9/sys/contrib/rdma/rdma_cma.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/contrib/rdma/rdma_cma.c
==============================================================================
--- stable/9/sys/contrib/rdma/rdma_cma.c	Fri Apr 27 18:08:15 2012	(r234735)
+++ stable/9/sys/contrib/rdma/rdma_cma.c	Fri Apr 27 18:21:45 2012	(r234736)
@@ -1252,7 +1252,7 @@ static int cma_iw_handler(struct iw_cm_i
 		*sin = iw_event->local_addr;
 		sin = (struct sockaddr_in *) &id_priv->id.route.addr.dst_addr;
 		*sin = iw_event->remote_addr;
-		switch (iw_event->status) {
+		switch ((int)iw_event->status) {
 		case 0:
 			event.event = RDMA_CM_EVENT_ESTABLISHED;
 			break;



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