From 9c0ce38df3d9026785155d06fc62bdd7acaf8bf0 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Fri, 3 Oct 2008 14:05:45 -0400 Subject: [FreeBSD] Use M_WAITOK when allocating driver memory. We don't explicitly check for error here and M_WAITOK will just put the process to sleep waiting on resources to become available. Suggested by John Baldwin --- bsd-core/i915_drv.c | 4 +++- bsd-core/mach64_drv.c | 4 +++- bsd-core/mga_drv.c | 4 +++- bsd-core/r128_drv.c | 4 +++- bsd-core/radeon_drv.c | 4 +++- bsd-core/savage_drv.c | 4 +++- bsd-core/sis_drv.c | 4 +++- bsd-core/tdfx_drv.c | 4 +++- bsd-core/via_drv.c | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/bsd-core/i915_drv.c b/bsd-core/i915_drv.c index def35f0b..b2658f05 100644 --- a/bsd-core/i915_drv.c +++ b/bsd-core/i915_drv.c @@ -111,7 +111,9 @@ i915_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + i915_configure(dev); return drm_attach(nbdev, i915_pciidlist); diff --git a/bsd-core/mach64_drv.c b/bsd-core/mach64_drv.c index adb83d3a..dcf35bbd 100644 --- a/bsd-core/mach64_drv.c +++ b/bsd-core/mach64_drv.c @@ -85,7 +85,9 @@ mach64_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + mach64_configure(dev); return drm_attach(nbdev, mach64_pciidlist); diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c index 5554236a..dfb4b719 100644 --- a/bsd-core/mga_drv.c +++ b/bsd-core/mga_drv.c @@ -129,7 +129,9 @@ mga_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + mga_configure(dev); return drm_attach(nbdev, mga_pciidlist); diff --git a/bsd-core/r128_drv.c b/bsd-core/r128_drv.c index 4c20af4d..f3251141 100644 --- a/bsd-core/r128_drv.c +++ b/bsd-core/r128_drv.c @@ -84,7 +84,9 @@ r128_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + r128_configure(dev); return drm_attach(nbdev, r128_pciidlist); diff --git a/bsd-core/radeon_drv.c b/bsd-core/radeon_drv.c index 8ab3e995..6b90dd69 100644 --- a/bsd-core/radeon_drv.c +++ b/bsd-core/radeon_drv.c @@ -89,7 +89,9 @@ radeon_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + radeon_configure(dev); return drm_attach(nbdev, radeon_pciidlist); diff --git a/bsd-core/savage_drv.c b/bsd-core/savage_drv.c index 35fcdfa3..7f406e0b 100644 --- a/bsd-core/savage_drv.c +++ b/bsd-core/savage_drv.c @@ -75,7 +75,9 @@ savage_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + savage_configure(dev); return drm_attach(nbdev, savage_pciidlist); diff --git a/bsd-core/sis_drv.c b/bsd-core/sis_drv.c index 2ae1bff0..c69a093c 100644 --- a/bsd-core/sis_drv.c +++ b/bsd-core/sis_drv.c @@ -69,7 +69,9 @@ sis_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + sis_configure(dev); return drm_attach(nbdev, sis_pciidlist); diff --git a/bsd-core/tdfx_drv.c b/bsd-core/tdfx_drv.c index 44948b5c..8c10ea8c 100644 --- a/bsd-core/tdfx_drv.c +++ b/bsd-core/tdfx_drv.c @@ -71,7 +71,9 @@ tdfx_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + tdfx_configure(dev); return drm_attach(nbdev, tdfx_pciidlist); diff --git a/bsd-core/via_drv.c b/bsd-core/via_drv.c index e5f7d493..d2a1e676 100644 --- a/bsd-core/via_drv.c +++ b/bsd-core/via_drv.c @@ -82,7 +82,9 @@ via_attach(device_t nbdev) bzero(dev, sizeof(struct drm_device)); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, M_NOWAIT | M_ZERO); + dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + M_WAITOK | M_ZERO); + via_configure(dev); return drm_attach(nbdev, via_pciidlist); -- cgit v1.2.3