From patchwork Tue Aug 11 07:54:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 6989511 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 40581C05AC for ; Tue, 11 Aug 2015 07:55:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DD6C2051C for ; Tue, 11 Aug 2015 07:55:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AF0D8205F0 for ; Tue, 11 Aug 2015 07:55:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F1AC26E8C6; Tue, 11 Aug 2015 00:55:07 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mblankhorst.nl (mblankhorst.nl [141.105.120.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 45E686E4AA; Tue, 11 Aug 2015 00:55:06 -0700 (PDT) Received: from patser.lan (5ED48611.cm-7-5c.dynamic.ziggo.nl [94.212.134.17]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mlankhorst) by mblankhorst.nl (Postfix) with ESMTPSA id E7B17E0002; Tue, 11 Aug 2015 09:55:04 +0200 (CEST) From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/core: Set mode to NULL when connectors in a set drops to 0. Date: Tue, 11 Aug 2015 09:54:59 +0200 Message-Id: <1439279699-27110-1-git-send-email-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.1.0 Cc: intel-gfx@lists.freedesktop.org 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.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 Without this when a MST connector is removed drm_atomic_helper_set_config can complain about set->mode && !set->num_connectors. ------------[ cut here ]------------ WARNING: CPU: 2 PID: 2403 at drivers/gpu/drm/drm_atomic_helper.c:1673 drm_atomic_helper_set_config+0x22e/0x420() CPU: 2 PID: 2403 Comm: kms_flip Not tainted 4.2.0-rc5 #4233 Hardware name: NUC5i7RYB, BIOS RYBDWi35.86A.0246.2015.0309.1355 03/09/2015 ffffffff81ac75e8 ffff88004e4ffbf8 ffffffff81714c34 0000000080000000 0000000000000000 ffff88004e4ffc38 ffffffff8107bf81 ffff88004e4ffc48 ffff8800d8ca0690 ffff8800d8d7a080 ffff8800d8cc2290 ffff8800d07bc9f0 Call Trace: [] dump_stack+0x4f/0x7b [] warn_slowpath_common+0x81/0xc0 [] warn_slowpath_null+0x15/0x20 [] drm_atomic_helper_set_config+0x22e/0x420 [] ? drm_atomic_helper_plane_set_property+0x84/0xc0 [] drm_mode_set_config_internal+0x61/0x100 [] restore_fbdev_mode+0xbd/0xe0 [] drm_fb_helper_restore_fbdev_mode_unlocked+0x24/0x70 [] intel_fbdev_restore_mode+0x21/0x80 [i915] [] i915_driver_lastclose+0x9/0x10 [i915] [] drm_lastclose+0x29/0x130 [] drm_release+0x314/0x500 [] __fput+0xe5/0x1f0 [] ____fput+0x9/0x10 [] task_work_run+0x88/0xb0 [] do_exit+0x37f/0xa90 [] ? selinux_file_ioctl+0x48/0xc0 [] ? security_file_ioctl+0x3e/0x60 [] do_group_exit+0x40/0xa0 [] SyS_exit_group+0xf/0x10 [] entry_SYSCALL_64_fastpath+0x12/0x6a ---[ end trace 0daf358c49351567 ]--- Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/drm_fb_helper.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 5875059a7625..418d299f3b12 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -168,11 +168,14 @@ static void remove_from_modeset(struct drm_mode_set *set, } set->num_connectors--; - /* because i915 is pissy about this.. + /* * TODO maybe need to makes sure we set it back to !=NULL somewhere? */ - if (set->num_connectors == 0) + if (set->num_connectors == 0) { set->fb = NULL; + drm_mode_destroy(connector->dev, set->mode); + set->mode = NULL; + } } int drm_fb_helper_remove_one_connector(struct drm_fb_helper *fb_helper,