diff mbox

drm/atomic: allow setting a blob to NULL using id = 0

Message ID 1450451839-26341-2-git-send-email-lionel.g.landwerlin@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lionel Landwerlin Dec. 18, 2015, 3:17 p.m. UTC
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 drivers/gpu/drm/drm_atomic.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

Comments

Daniel Stone Dec. 18, 2015, 4:55 p.m. UTC | #1
On 18 December 2015 at 15:17, Lionel Landwerlin
<lionel.g.landwerlin@intel.com> wrote:
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>  drivers/gpu/drm/drm_atomic.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 65f007a..b8c90a4 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -403,12 +403,14 @@ EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
>  static int drm_atomic_crtc_set_blob(struct drm_device *dev,
>         struct drm_property_blob **state_blob, uint32_t blob_id)
>  {
> -       struct drm_property_blob *blob;
> +       struct drm_property_blob *blob = NULL;
>
> -       blob = drm_property_lookup_blob(dev, blob_id);
> -       if (!blob) {
> -               DRM_DEBUG_KMS("Invalid Blob ID\n");
> -               return -EINVAL;
> +       if (blob_id != 0) {
> +               blob = drm_property_lookup_blob(dev, blob_id);
> +               if (!blob) {
> +                       DRM_DEBUG_KMS("Invalid Blob ID\n");
> +                       return -EINVAL;
> +               }
>         }

Heh, almost exactly what I suggested! :)

Given that this was only introduced by 1/6 of the CM patchset though,
just integrate this into the next round of CM rather than posting it
separately I think.

Cheers,
Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 65f007a..b8c90a4 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -403,12 +403,14 @@  EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
 static int drm_atomic_crtc_set_blob(struct drm_device *dev,
 	struct drm_property_blob **state_blob, uint32_t blob_id)
 {
-	struct drm_property_blob *blob;
+	struct drm_property_blob *blob = NULL;
 
-	blob = drm_property_lookup_blob(dev, blob_id);
-	if (!blob) {
-		DRM_DEBUG_KMS("Invalid Blob ID\n");
-		return -EINVAL;
+	if (blob_id != 0) {
+		blob = drm_property_lookup_blob(dev, blob_id);
+		if (!blob) {
+			DRM_DEBUG_KMS("Invalid Blob ID\n");
+			return -EINVAL;
+		}
 	}
 
 	if (*state_blob)