From patchwork Sat Nov 2 17:56:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11224199 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 96F211390 for ; Sat, 2 Nov 2019 17:57:00 +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 7EDD621726 for ; Sat, 2 Nov 2019 17:57:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7EDD621726 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 817766E4EA; Sat, 2 Nov 2019 17:56:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id BBB106E4EA; Sat, 2 Nov 2019 17:56:50 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id a11so12726092wra.6; Sat, 02 Nov 2019 10:56:50 -0700 (PDT) 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=nFY1vqzSONgdwE5+azceCzycYUt1l/wUOCKvdJLbIwE=; b=um8aX40oETSe0H9yS21LlwofAZ/CgQm3SWG8NJSMFxb2GhH+b0uSDMHsA2AZm4dHV5 1qi0piZrhcfEb5RuGv4JxGe0ANtYbN3pptvgbD1j9iSHrO6HzdcyN33RZs0gEDp8M7lP Me/MvNOvPIElI007U+hx1LsgY9eCebAVaWSoHyPLbBFx6Yhv3uKUuG+yeAKZf2p0hjXj q7W4OC3t5wVJEC7+iTOISPQNgy3ah6fXc3P4Tg7DTt4Ao/s5gRSnRWNh0FZ8fy0FrYLh Z6UCxM++pfV9ndQB8hWCuWd6f3FoM6xBS/5QjIgG8hymrIwzNtlDETRocaEzSCBYi5P0 kuPg== X-Gm-Message-State: APjAAAUn1SbFNGC6Tr+XWlizcW329zlLgh14lDvJpd6207sCR2+lLKEV eUPGE5qvlRnyhjgvvpet8lE= X-Google-Smtp-Source: APXvYqyTBiZYvfTa39s9N+6sTjLpKVJXitd6D44ddHfUz9PxVTxgBDpCrbr5sez8rkJvcruoMq3iww== X-Received: by 2002:a5d:6944:: with SMTP id r4mr8258412wrw.238.1572717409261; Sat, 02 Nov 2019 10:56:49 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id t29sm23428383wrb.53.2019.11.02.10.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Nov 2019 10:56:47 -0700 (PDT) From: Thierry Reding To: Ben Skeggs , Joerg Roedel Subject: [PATCH v2 4/9] drm/nouveau: tegra: Do not try to disable PCI device Date: Sat, 2 Nov 2019 18:56:32 +0100 Message-Id: <20191102175637.3065-5-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191102175637.3065-1-thierry.reding@gmail.com> References: <20191102175637.3065-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=nFY1vqzSONgdwE5+azceCzycYUt1l/wUOCKvdJLbIwE=; b=tw+Jpba8055Bl8J2Hlie89ay0WxADSFMhaavglIxVwMeYCKa98EiG+IJGKD99CGMf8 MmdBt7wzXf7CCufbUnVkS7Cbp0BDpGuyca+to8s4g0lEZtpDUlOlYdKCC7JbKIB5KE1X LS7xWBahzkzEeP9ofB1SwNH0vI0e6trPz2AVeq/1zDoJZF1goHsbSdVjW1XS8f2sxLev zEE5jpuvrMBgqmoEBQC/y1HpGo4hlV1njKU6fNkTgH+K7MceB8WxjyzYHRCsP1QMRtdN tGhQ+oZciB0MKcL/zYQMsgn0xwUKwpZr5V2A4lcthRicFvIKR+wOTsixgsiq5F4lIt9r Z85A== 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, Ben Dooks , 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. Reviewed-by: Lyude Paul 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