diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 9fb4a6d4c38e..915d6bc886db 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -35,6 +35,7 @@ #include #include #include +#include /** * @defgroup NEWBUS newbus - a generic framework for managing devices @@ -813,12 +814,9 @@ static __inline type varp ## _get_ ## var(device_t 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); \ - } \ + KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ + __func__, device_get_nameunit(dev), \ + device_get_nameunit(device_get_parent(dev)), e)); \ return ((type) v); \ } \ \ @@ -828,12 +826,9 @@ static __inline void varp ## _set_ ## var(device_t dev, type t) \ 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); \ - } \ + KASSERT(e == 0, ("%s failed for %s on bus %s, error = %d", \ + __func__, device_get_nameunit(dev), \ + device_get_nameunit(device_get_parent(dev)), e)); \ } /**