Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jul 2019 15:28:42 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r350034 - stable/11/sys/sys
Message-ID:  <201907161528.x6GFSgoW095402@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Tue Jul 16 15:28:41 2019
New Revision: 350034
URL: https://svnweb.freebsd.org/changeset/base/350034

Log:
  MFC r348688: first step towards enforcing must-succeed semantics for bus accessors

Modified:
  stable/11/sys/sys/bus.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/bus.h
==============================================================================
--- stable/11/sys/sys/bus.h	Tue Jul 16 15:28:28 2019	(r350033)
+++ stable/11/sys/sys/bus.h	Tue Jul 16 15:28:41 2019	(r350034)
@@ -787,16 +787,30 @@ DECLARE_MODULE(name##_##busname, name##_##busname##_mo
 static __inline type varp ## _get_ ## var(device_t dev)			\
 {									\
 	uintptr_t v;							\
-	BUS_READ_IVAR(device_get_parent(dev), dev,			\
+	int e;								\
+	e = BUS_READ_IVAR(device_get_parent(dev), dev,			\
 	    ivarp ## _IVAR_ ## ivar, &v);				\
+	if (e != 0) {							\
+		device_printf(dev, "failed to read ivar "		\
+		    __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, "	\
+		    "error = %d\n",					\
+		    device_get_nameunit(device_get_parent(dev)), e);	\
+	}								\
 	return ((type) v);						\
 }									\
 									\
 static __inline void varp ## _set_ ## var(device_t dev, type t)		\
 {									\
 	uintptr_t v = (uintptr_t) t;					\
-	BUS_WRITE_IVAR(device_get_parent(dev), dev,			\
+	int e;								\
+	e = BUS_WRITE_IVAR(device_get_parent(dev), dev,			\
 	    ivarp ## _IVAR_ ## ivar, v);				\
+	if (e != 0) {							\
+		device_printf(dev, "failed to write ivar "		\
+		    __XSTRING(ivarp ## _IVAR_ ## ivar) " on bus %s, "	\
+		    "error = %d\n",					\
+		    device_get_nameunit(device_get_parent(dev)), e);	\
+	}								\
 }
 
 /**



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