Commit 10e8cb7e authored by Daniel Stone's avatar Daniel Stone Committed by Daniel Vetter

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: default avatarDaniel Stone <daniels@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@intel.com>
Tested-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 99531d9b
...@@ -4154,6 +4154,10 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev, ...@@ -4154,6 +4154,10 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
* @dev: DRM device to create property for * @dev: DRM device to create property for
* @length: Length to allocate for blob data * @length: Length to allocate for blob data
* @data: If specified, copies data into blob * @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 * struct drm_property_blob *
drm_property_create_blob(struct drm_device *dev, size_t length, 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, ...@@ -4163,11 +4167,11 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
int ret; int ret;
if (!length) if (!length)
return NULL; return ERR_PTR(-EINVAL);
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
if (!blob) if (!blob)
return NULL; return ERR_PTR(-ENOMEM);
blob->length = length; blob->length = length;
blob->dev = dev; blob->dev = dev;
...@@ -4181,7 +4185,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, ...@@ -4181,7 +4185,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
if (ret) { if (ret) {
kfree(blob); kfree(blob);
mutex_unlock(&dev->mode_config.blob_lock); mutex_unlock(&dev->mode_config.blob_lock);
return NULL; return ERR_PTR(-EINVAL);
} }
kref_init(&blob->refcount); kref_init(&blob->refcount);
...@@ -4370,8 +4374,8 @@ static int drm_property_replace_global_blob(struct drm_device *dev, ...@@ -4370,8 +4374,8 @@ static int drm_property_replace_global_blob(struct drm_device *dev,
if (length && data) { if (length && data) {
new_blob = drm_property_create_blob(dev, length, data); new_blob = drm_property_create_blob(dev, length, data);
if (!new_blob) if (IS_ERR(new_blob))
return -EINVAL; return PTR_ERR(new_blob);
} }
/* This does not need to be synchronised with blob_lock, as the /* This does not need to be synchronised with blob_lock, as the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment