From patchwork Fri May 22 12:34:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6464071 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2AD929F1C1 for ; Fri, 22 May 2015 12:35:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CDD4420499 for ; Fri, 22 May 2015 12:35:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ECD0F20497 for ; Fri, 22 May 2015 12:35:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14AFD6EA74; Fri, 22 May 2015 05:35:05 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DC136EA74 for ; Fri, 22 May 2015 05:35:03 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 2D046601B82 From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/11] drm: Retain reference to blob properties in lookup Date: Fri, 22 May 2015 13:34:46 +0100 Message-Id: <1432298094-22239-4-git-send-email-daniels@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1432298094-22239-1-git-send-email-daniels@collabora.com> References: <1432298094-22239-1-git-send-email-daniels@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we look up a blob property, make sure we retain a reference to the blob for the lifetime. Signed-off-by: Daniel Stone Tested-by: Sean Paul --- drivers/gpu/drm/drm_crtc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 7e5085f..da2b117 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -4661,7 +4661,9 @@ bool drm_property_change_valid_get(struct drm_property *property, for (i = 0; i < property->num_values; i++) valid_mask |= (1ULL << property->values[i]); return !(value & ~valid_mask); - } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) { + } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB) || + (drm_property_type_is(property, DRM_MODE_PROP_OBJECT) && + property->values[0] == DRM_MODE_OBJECT_BLOB)) { struct drm_property_blob *blob; if (value == 0) @@ -4709,6 +4711,8 @@ void drm_property_change_valid_put(struct drm_property *property, if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { if (property->values[0] == DRM_MODE_OBJECT_FB) drm_framebuffer_unreference(obj_to_fb(ref)); + else if (property->values[0] == DRM_MODE_OBJECT_BLOB) + drm_property_unreference_blob(obj_to_blob(ref)); } }