diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-07-20 07:17:00 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-07-25 00:12:17 -0400 |
commit | 1e179d4e283bd197035960ef751b5ccac06cbf91 (patch) | |
tree | 56c654d2772ceb77823669d79c0f1b491226dec5 | |
parent | d1c7871ddb1f588b8eb35affd9ee1a3d5e11cd0c (diff) |
drm/radeon: check for allocation failure in radeon_ring_backup()
Static checkers complain if this we don't check for allocation failure.
Also we can use the new kmalloc_array() function here as a cleanup.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index f2fc25de0b2f..ec79b3750430 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -594,7 +594,11 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring | |||
594 | } | 594 | } |
595 | 595 | ||
596 | /* and then save the content of the ring */ | 596 | /* and then save the content of the ring */ |
597 | *data = kmalloc(size * 4, GFP_KERNEL); | 597 | *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); |
598 | if (!*data) { | ||
599 | mutex_unlock(&rdev->ring_lock); | ||
600 | return 0; | ||
601 | } | ||
598 | for (i = 0; i < size; ++i) { | 602 | for (i = 0; i < size; ++i) { |
599 | (*data)[i] = ring->ring[ptr++]; | 603 | (*data)[i] = ring->ring[ptr++]; |
600 | ptr &= ring->ptr_mask; | 604 | ptr &= ring->ptr_mask; |