From patchwork Mon Dec 9 12:00:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11279259 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABCF6112B for ; Mon, 9 Dec 2019 12:00:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94303207FD for ; Mon, 9 Dec 2019 12:00:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94303207FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 59BA86E42A; Mon, 9 Dec 2019 12:00:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 23A1B6E439; Mon, 9 Dec 2019 12:00:17 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id p17so14620489wmi.3; Mon, 09 Dec 2019 04:00:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X/XOpyZsqG/KWvoSisq6x7AhYat6zso8yO/F5thGj3A=; b=DBFZOF11FCfD/6mQQFnXnCaZKswJZxkGyIHqNs7HNcJX+ZCFr0wEu/nMYIO6id09pt ue0cN3r63+MoF3EWX7caf4lKqLnS/SvJSnCVSYVVTXpqnEvC+jlW7LsXqwbn5ivxU8+h 1scE/zjf4M2S5VeAuO+enR7D0LfK6MJqwT0lsHev2hDnfelrRB2CbBTi1Q+P/ObaEVkW 1QzhOjxeUQgsnCHHMD1FpyS3VfHiDlLoivwtY3p8+/JszBAd+hCNdFsyKoA9gPyTpSVW wIR2LYp0v892hcx6FjbLWh66gT/IThpx1LMWn6VtCJw2RdEWJEe5ErAWjlex3+kbvO2L +DTw== X-Gm-Message-State: APjAAAXE4HdNxFDLXhlVAa78oQIh5FxDzKpH24Y8R1Zhb5pEVcTbYtcg fEymrbr8KID3CdEzyURqINM= X-Google-Smtp-Source: APXvYqwKIXZ/lXiOYFdsUXHqh0kNtYZfFbMT/CChCt4KHa9eSuuvZ5vhaaf3RW3PIdOimww2wv4/zw== X-Received: by 2002:a7b:c386:: with SMTP id s6mr24015907wmj.105.1575892815703; Mon, 09 Dec 2019 04:00:15 -0800 (PST) Received: from localhost (pD9E518ED.dip0.t-ipconnect.de. [217.229.24.237]) by smtp.gmail.com with ESMTPSA id a78sm12038740wme.9.2019.12.09.04.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 04:00:14 -0800 (PST) From: Thierry Reding To: Ben Skeggs Subject: [PATCH v3 4/9] drm/nouveau: tegra: Do not try to disable PCI device Date: Mon, 9 Dec 2019 13:00:00 +0100 Message-Id: <20191209120005.2254786-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191209120005.2254786-1-thierry.reding@gmail.com> References: <20191209120005.2254786-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X/XOpyZsqG/KWvoSisq6x7AhYat6zso8yO/F5thGj3A=; b=YQ4tBVvZm7q1NFbRpNhvsjkaHYJErSU7MKuJbBquAJbCD7/ye0m706FMsJ3DPetesS TMJcsNW8KXAtebsAXU8nBeuTOpGKEDDw5XxlFF9WSpkwntHbkDpcwzLKl11n+kXmslvG qL0kmFAPqo4itQJBEt+7Elt0zDKiZzT61XVMkW5kTaZwXxhculSaBr/O29cn7Yq3TNM8 bv2yD3oFJy8Mv3QnYc6FSbGHQC61b20oW2OHoHpzQ47kqushGoSb0EWhuR2U4YLyiQ/2 OhAm5KFpHPduHDXKwh6a/pGmEiy1JRofZmccSfzJjpTbS7olaQ+Y3R6XIA26WLGTS/De kOWg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding When Nouveau is instantiated on top of a platform device, the dev->pdev field will be NULL and calling pci_disable_device() will crash. Move the PCI disabling code to the PCI specific driver removal code. Signed-off-by: Thierry Reding --- drivers/gpu/drm/nouveau/nouveau_drm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 2cd83849600f..b65ae817eabf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c @@ -715,7 +715,6 @@ static int nouveau_drm_probe(struct pci_dev *pdev, void nouveau_drm_device_remove(struct drm_device *dev) { - struct pci_dev *pdev = dev->pdev; struct nouveau_drm *drm = nouveau_drm(dev); struct nvkm_client *client; struct nvkm_device *device; @@ -727,7 +726,6 @@ nouveau_drm_device_remove(struct drm_device *dev) device = nvkm_device_find(client->device); nouveau_drm_device_fini(dev); - pci_disable_device(pdev); drm_dev_put(dev); nvkm_device_del(&device); } @@ -738,6 +736,7 @@ nouveau_drm_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); nouveau_drm_device_remove(dev); + pci_disable_device(pdev); } static int