From patchwork Wed Oct 30 10:59:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3113941 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 16A629F3E2 for ; Wed, 30 Oct 2013 10:59:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 785872022A for ; Wed, 30 Oct 2013 10:59:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 57DDC2020E for ; Wed, 30 Oct 2013 10:59:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 52A89EEE4A for ; Wed, 30 Oct 2013 03:59:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com [209.85.214.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 58324EE84F for ; Wed, 30 Oct 2013 03:59:08 -0700 (PDT) Received: by mail-bk0-f41.google.com with SMTP id na10so482082bkb.0 for ; Wed, 30 Oct 2013 03:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=fFuZ66FlANWavbBG/m7SXWjAeMUbnnWiqhjKFuAXkdw=; b=iR94+KTfEp5zx3JTKutxtUiRBvKVPEMLtgTfqFrkco1Xt9o4nv5a7+B2lEquNV5iqs XbbK1iv7ofg+DfdS+cCc6VGPGdrbe8Ap7iIzyy4qgz60YqtpkZzebpSH4H0NLlSD3bRI cIQs5WZJUDDv39xcztSy+R2NkbP7BcOVnia5OVTr7z2Nufo04dAvolhOuiMdCK/xAU53 I7o8PHB4tRl3/7RiWLiwChsbR/8aQkO7Ls+1ivVcB3XFCFLP8iwCRTbmKUryYKLQNZh6 4rJ25HlfnNTqQTEfMRnetS8ZUQ3YrpzK/iy8/cWTBjiq07mlMcJzXaHuvyvNGsAlygIq eWzQ== X-Received: by 10.204.173.6 with SMTP id n6mr2618845bkz.5.1383130747194; Wed, 30 Oct 2013 03:59:07 -0700 (PDT) Received: from localhost (port-13752.pppoe.wtnet.de. [84.46.53.237]) by mx.google.com with ESMTPSA id z6sm18290055bkn.8.2013.10.30.03.59.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Oct 2013 03:59:06 -0700 (PDT) From: Thierry Reding To: David Airlie Subject: [PATCH] drm/sysfs: Do not drop device reference twice Date: Wed, 30 Oct 2013 11:59:05 +0100 Message-Id: <1383130745-32165-1-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.6 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 device_unregister() already drops its reference to the struct device, so explicitly calling put_device() before device_unregister() can cause the device to have been freed before it can be unregistered. Signed-off-by: Thierry Reding Reviewed-by: Paulo Zanoni Tested-by: Paulo Zanoni Tested-by: Ben Widawsky --- drivers/gpu/drm/drm_sysfs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index dae42c7..db1c8f9 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -439,7 +439,6 @@ err_out_files: device_remove_file(connector->kdev, &connector_attrs_opt1[i]); for (i = 0; i < attr_cnt; i++) device_remove_file(connector->kdev, &connector_attrs[i]); - put_device(connector->kdev); device_unregister(connector->kdev); out: @@ -472,7 +471,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) for (i = 0; i < ARRAY_SIZE(connector_attrs); i++) device_remove_file(connector->kdev, &connector_attrs[i]); sysfs_remove_bin_file(&connector->kdev->kobj, &edid_attr); - put_device(connector->kdev); device_unregister(connector->kdev); connector->kdev = NULL; }