From patchwork Wed Nov 13 10:42:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3177821 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9FF9F9F39E for ; Wed, 13 Nov 2013 10:42:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5CD23205E5 for ; Wed, 13 Nov 2013 10:42:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 6E347204E1 for ; Wed, 13 Nov 2013 10:42:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D06AFB029; Wed, 13 Nov 2013 02:42:44 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com [209.85.215.180]) by gabe.freedesktop.org (Postfix) with ESMTP id B8263FB029 for ; Wed, 13 Nov 2013 02:42:42 -0800 (PST) Received: by mail-ea0-f180.google.com with SMTP id b11so132834eae.25 for ; Wed, 13 Nov 2013 02:42:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FIKHFLst+KFL/GM9m8uAg36A7zTQRhL7Kw0PuBUsqyw=; b=Sxymd3tNX3z3tAC/oJlF0ubhVFwKoTNMigrrhqMLgBHABomSpUmfJd4Lb0uoFoWlsl X4i04fKSPzc0jGOWs+5HWva2mZiL58ubMSpIIP0GldZeM/nWUqOFkhRdXE/OB4sBOOZK Mfsdc5vc0NoA+CKaIIkuP+9JKw0mba9G27rdg5PJJf90iX1URquTZDYPcPlO8EEWbKsN Ea7pjCz4U43TlB/KXEu4BMxRMQjNQ/UeiIzOglxhS14EA3YrJRVfNzJlvuw1e5/vVjpU GUYE8vdZflhE1R84uYSNq4inTHKY5OswAxurodeHuxVfkcM5OH/ka0SiYuIkyP4I4NND XeHw== X-Received: by 10.14.246.140 with SMTP id q12mr45110eer.123.1384339361909; Wed, 13 Nov 2013 02:42:41 -0800 (PST) Received: from localhost.localdomain (stgt-5f71ad8c.pool.mediaWays.net. [95.113.173.140]) by mx.google.com with ESMTPSA id w6sm86744341eeo.12.2013.11.13.02.42.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Nov 2013 02:42:41 -0800 (PST) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: check for !kdev in drm_unplug_minor() Date: Wed, 13 Nov 2013 11:42:26 +0100 Message-Id: <1384339346-31664-1-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.4.2 Cc: Huax Lu X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 We moved minor deallocation to drm_dev_free() in: commit 8f6599da8e772fa8de54cdf98e9e03cbaf3946da Author: David Herrmann Date: Sun Oct 20 18:55:45 2013 +0200 drm: delay minor destruction to drm_dev_free() However, this causes a call to drm_unplug_minor(), which should just do nothing as drm_dev_unregister() already called this. But a separate patch caused kdev lifetime changes: commit 5bdebb183c9702a8c57a01dff09337be3de337a6 Author: Dave Airlie Date: Fri Oct 11 14:07:25 2013 +1000 drm/sysfs: sort out minor and connector device object lifetimes. Thus making our dev_is_registered() call useles (and even segfault if it is NULL). Replace it with a simple !kdev test and we're fine. Reported-by: Huax Lu Reported-by: Daniel Vetter Signed-off-by: David Herrmann Tested-by: lu hua Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index c200136..f53d524 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c @@ -338,7 +338,7 @@ err_idr: */ static void drm_unplug_minor(struct drm_minor *minor) { - if (!minor || !device_is_registered(minor->kdev)) + if (!minor || !minor->kdev) return; #if defined(CONFIG_DEBUG_FS)