summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-05-22 13:34:50 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-05-22 16:18:22 +0200
commit10e8cb7e79391071b950a28a4d85790dd38fb714 (patch)
tree836fbdf42c5a3916c9b38a97bd9b530edb39f525 /drivers/gpu/drm/drm_crtc.c
parent99531d9bb76c649df15311c717deefdff7cc5b7b (diff)
downloadlwn-10e8cb7e79391071b950a28a4d85790dd38fb714.tar.gz
lwn-10e8cb7e79391071b950a28a4d85790dd38fb714.zip
drm: Return error value from blob creation
Change drm_property_create_blob to return an ERR_PTR-encoded error on failure, so we can pass the failure reason down. Signed-off-by: Daniel Stone <daniels@collabora.com> Cc: Maarten Lankhorst <maarten.lankhorst@intel.com> Tested-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 0844108e19e0..f661589b1dea 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -4154,6 +4154,10 @@ done:
* @dev: DRM device to create property for
* @length: Length to allocate for blob data
* @data: If specified, copies data into blob
+ *
+ * Returns:
+ * New blob property with a single reference on success, or an ERR_PTR
+ * value on failure.
*/
struct drm_property_blob *
drm_property_create_blob(struct drm_device *dev, size_t length,
@@ -4163,11 +4167,11 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
int ret;
if (!length)
- return NULL;
+ return ERR_PTR(-EINVAL);
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
if (!blob)
- return NULL;
+ return ERR_PTR(-ENOMEM);
blob->length = length;
blob->dev = dev;
@@ -4181,7 +4185,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
if (ret) {
kfree(blob);
mutex_unlock(&dev->mode_config.blob_lock);
- return NULL;
+ return ERR_PTR(-EINVAL);
}
kref_init(&blob->refcount);
@@ -4370,8 +4374,8 @@ static int drm_property_replace_global_blob(struct drm_device *dev,
if (length && data) {
new_blob = drm_property_create_blob(dev, length, data);
- if (!new_blob)
- return -EINVAL;
+ if (IS_ERR(new_blob))
+ return PTR_ERR(new_blob);
}
/* This does not need to be synchronised with blob_lock, as the