drm/agpsupport: use kzalloc instead of kmalloc/memset
Signed-off-by: Dave Airlie <airlied@redhat.com>hifive-unleashed-5.1
parent
4efafebe70
commit
d5e41ad3b9
|
@ -204,11 +204,9 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
|
||||||
|
|
||||||
if (!dev->agp || !dev->agp->acquired)
|
if (!dev->agp || !dev->agp->acquired)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (!(entry = kmalloc(sizeof(*entry), GFP_KERNEL)))
|
if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL)))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(entry, 0, sizeof(*entry));
|
|
||||||
|
|
||||||
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
|
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||||
type = (u32) request->type;
|
type = (u32) request->type;
|
||||||
if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) {
|
if (!(memory = agp_allocate_memory(dev->agp->bridge, pages, type))) {
|
||||||
|
@ -401,9 +399,8 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_agp_head *head = NULL;
|
struct drm_agp_head *head = NULL;
|
||||||
|
|
||||||
if (!(head = kmalloc(sizeof(*head), GFP_KERNEL)))
|
if (!(head = kzalloc(sizeof(*head), GFP_KERNEL)))
|
||||||
return NULL;
|
return NULL;
|
||||||
memset((void *)head, 0, sizeof(*head));
|
|
||||||
head->bridge = agp_find_bridge(dev->pdev);
|
head->bridge = agp_find_bridge(dev->pdev);
|
||||||
if (!head->bridge) {
|
if (!head->bridge) {
|
||||||
if (!(head->bridge = agp_backend_acquire(dev->pdev))) {
|
if (!(head->bridge = agp_backend_acquire(dev->pdev))) {
|
||||||
|
|
Loading…
Reference in New Issue