diff options
Diffstat (limited to 'drivers/gpu/drm/mga/mga_dma.c')
-rw-r--r-- | drivers/gpu/drm/mga/mga_dma.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c index 7a6bf9ffc5a3..6c67a02910c8 100644 --- a/drivers/gpu/drm/mga/mga_dma.c +++ b/drivers/gpu/drm/mga/mga_dma.c | |||
@@ -254,23 +254,20 @@ static int mga_freelist_init(struct drm_device * dev, drm_mga_private_t * dev_pr | |||
254 | int i; | 254 | int i; |
255 | DRM_DEBUG("count=%d\n", dma->buf_count); | 255 | DRM_DEBUG("count=%d\n", dma->buf_count); |
256 | 256 | ||
257 | dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); | 257 | dev_priv->head = kzalloc(sizeof(drm_mga_freelist_t), GFP_KERNEL); |
258 | if (dev_priv->head == NULL) | 258 | if (dev_priv->head == NULL) |
259 | return -ENOMEM; | 259 | return -ENOMEM; |
260 | 260 | ||
261 | memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); | ||
262 | SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0); | 261 | SET_AGE(&dev_priv->head->age, MGA_BUFFER_USED, 0); |
263 | 262 | ||
264 | for (i = 0; i < dma->buf_count; i++) { | 263 | for (i = 0; i < dma->buf_count; i++) { |
265 | buf = dma->buflist[i]; | 264 | buf = dma->buflist[i]; |
266 | buf_priv = buf->dev_private; | 265 | buf_priv = buf->dev_private; |
267 | 266 | ||
268 | entry = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); | 267 | entry = kzalloc(sizeof(drm_mga_freelist_t), GFP_KERNEL); |
269 | if (entry == NULL) | 268 | if (entry == NULL) |
270 | return -ENOMEM; | 269 | return -ENOMEM; |
271 | 270 | ||
272 | memset(entry, 0, sizeof(drm_mga_freelist_t)); | ||
273 | |||
274 | entry->next = dev_priv->head->next; | 271 | entry->next = dev_priv->head->next; |
275 | entry->prev = dev_priv->head; | 272 | entry->prev = dev_priv->head; |
276 | SET_AGE(&entry->age, MGA_BUFFER_FREE, 0); | 273 | SET_AGE(&entry->age, MGA_BUFFER_FREE, 0); |
@@ -301,7 +298,7 @@ static void mga_freelist_cleanup(struct drm_device * dev) | |||
301 | entry = dev_priv->head; | 298 | entry = dev_priv->head; |
302 | while (entry) { | 299 | while (entry) { |
303 | next = entry->next; | 300 | next = entry->next; |
304 | drm_free(entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); | 301 | kfree(entry); |
305 | entry = next; | 302 | entry = next; |
306 | } | 303 | } |
307 | 304 | ||
@@ -399,12 +396,11 @@ int mga_driver_load(struct drm_device * dev, unsigned long flags) | |||
399 | drm_mga_private_t *dev_priv; | 396 | drm_mga_private_t *dev_priv; |
400 | int ret; | 397 | int ret; |
401 | 398 | ||
402 | dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); | 399 | dev_priv = kzalloc(sizeof(drm_mga_private_t), GFP_KERNEL); |
403 | if (!dev_priv) | 400 | if (!dev_priv) |
404 | return -ENOMEM; | 401 | return -ENOMEM; |
405 | 402 | ||
406 | dev->dev_private = (void *)dev_priv; | 403 | dev->dev_private = (void *)dev_priv; |
407 | memset(dev_priv, 0, sizeof(drm_mga_private_t)); | ||
408 | 404 | ||
409 | dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; | 405 | dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; |
410 | dev_priv->chipset = flags; | 406 | dev_priv->chipset = flags; |
@@ -1150,7 +1146,7 @@ int mga_dma_buffers(struct drm_device *dev, void *data, | |||
1150 | */ | 1146 | */ |
1151 | int mga_driver_unload(struct drm_device * dev) | 1147 | int mga_driver_unload(struct drm_device * dev) |
1152 | { | 1148 | { |
1153 | drm_free(dev->dev_private, sizeof(drm_mga_private_t), DRM_MEM_DRIVER); | 1149 | kfree(dev->dev_private); |
1154 | dev->dev_private = NULL; | 1150 | dev->dev_private = NULL; |
1155 | 1151 | ||
1156 | return 0; | 1152 | return 0; |