Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2016 17:01:08 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302577 - head/sys/dev/drm2
Message-ID:  <201607111701.u6BH189R083052@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Mon Jul 11 17:01:07 2016
New Revision: 302577
URL: https://svnweb.freebsd.org/changeset/base/302577

Log:
  Add missing default case to capable(..) function definition
  
  By definition (enum __drm_capabilities), cases other than CAP_SYS_ADMIN
  aren't possible. Add in a KASSERT safety belt and return false in
  !INVARIANTS case if an invalid value is passed in, as it would be a
  programmer error.
  
  This fixes a -Wreturn-type error with gcc 5.3.0.
  
  Differential Revision:	https://reviews.freebsd.org/D7188
  MFC after:	1 week
  Reported by:	devel/amd64-gcc (5.3.0)
  Reviewed by:	dumbbell
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/dev/drm2/drm_os_freebsd.h

Modified: head/sys/dev/drm2/drm_os_freebsd.h
==============================================================================
--- head/sys/dev/drm2/drm_os_freebsd.h	Mon Jul 11 16:56:51 2016	(r302576)
+++ head/sys/dev/drm2/drm_os_freebsd.h	Mon Jul 11 17:01:07 2016	(r302577)
@@ -438,6 +438,10 @@ capable(enum __drm_capabilities cap)
 	switch (cap) {
 	case CAP_SYS_ADMIN:
 		return DRM_SUSER(curthread);
+	default:
+		KASSERT(false,
+		    ("%s: unhandled capability: %0x", __func__, cap));
+		return (false);
 	}
 }
 



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