[PATCH] qxl: correctly handling failed allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since kmalloc can be failed in memory pressure, 
when fails, return error code.

Signed-off-by: Insu Yun <wuninsu@xxxxxxxxx>
---
 drivers/gpu/drm/qxl/qxl_kms.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index b2977a1..2e99854 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -221,6 +221,9 @@ static int qxl_device_init(struct qxl_device *qdev,
 		kmalloc(qdev->n_mem_slots * sizeof(struct qxl_memslot),
 			GFP_KERNEL);
 
+	if (!qdev->memslots)
+		return -ENOMEM;
+
 	idr_init(&qdev->release_idr);
 	spin_lock_init(&qdev->release_idr_lock);
 	spin_lock_init(&qdev->release_lock);
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux