Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1058599pxk; Mon, 31 Aug 2020 08:42:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVkrfVnbBgkgAdaZisLFd4nhyWCDPt/IdbZhVW14+ginqxx8LSaGlse+A9LU1tYT9sBv3l X-Received: by 2002:a50:f28b:: with SMTP id f11mr1732836edm.44.1598888529562; Mon, 31 Aug 2020 08:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598888529; cv=none; d=google.com; s=arc-20160816; b=fUH4dNFT8pIv95nlvowU9gYVcrZX/R7UoCI84g56rww2eQQwe/30MPs43Wx5CX0PUW wzJorQjnAYsgrRkjIvtK9aiBo2koIpptTM5q00DUGl1WBbnlBI471QPL8qk1gGLFNmzZ J6gIbPidlvfNj3ehvR1mQVpZ8SC1HGJG0TjOjG4ZIOOGbNXuRZmZcWaSCFmJP5Va6s4w up0nQy3xvXp0fodtDlfI4QZt2cVUBFlrFmbTtPk6RyZ8gbBpyAqgoIEkoC+6yecCiD0v +O9k4oJ81dZVLYYUOcG+vsrt6p6MxdmhdLnTcPDc0NFB4p0C1RcEFNbFOx0n5xskufnW dp7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c57nE9kL2V4eup7kpPjxPNCbuaOJFb2Rcng57dQwoyU=; b=pNscf+KF0a/aG6pEqo/J+bzi7NsYXBwkKeNWO6wthhHivp7+bkRUzKt2yHWtmnBhUA aEy1sFuNkAd45YO6uv8c1ecWrzY80ZlGwyhTJ6uj9CtCpR/0el86WxzqVUOmgUaIatur d6R494WFpcq+mt/Xqf2QFaegxSZw2RQcgypsD7mzFdgSmaFjwCXBEnSHHTCOkKJ/aJ8D BwUYvgJuFgWIBBdTKD6ogHsRNe4SJbTrHZaI3qf5ezLhYh+Ag1/Tw+h8Rnoq/3CiAnLi HASBhv0LKvvV/Xx9jkNdhX/X1APWAICY1uYsowSvFYdl3VRaOWdOXkRvhrsD2PvpzVb4 UCPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KUINvk+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si1455246eja.287.2020.08.31.08.41.46; Mon, 31 Aug 2020 08:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KUINvk+o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729308AbgHaPkG (ORCPT + 99 others); Mon, 31 Aug 2020 11:40:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:38990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728502AbgHaP35 (ORCPT ); Mon, 31 Aug 2020 11:29:57 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93C5B20E65; Mon, 31 Aug 2020 15:29:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598887797; bh=L0Iz0oktZ4DsRF8xV00NFozhcnwlPIlJfnhtNskrnaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KUINvk+ooagsUl8J/86+Tzr6MiSrHv0OJnTNTYFUibr6tseToNQIKXGbzT/3EVPFR 7Bismvn18jrc7/JU0y2qyBhHI6SwYznCJeny237RgrZu/gAs7YFsLf49ZYwhLQ4ZJ8 W36u2hQAkTVqqwFWFOzyQB3fD80V6CayBgQ0Auaw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ofir Bitton , Oded Gabbay , Sasha Levin Subject: [PATCH AUTOSEL 5.8 14/42] habanalabs: unmap PCI bars upon iATU failure Date: Mon, 31 Aug 2020 11:29:06 -0400 Message-Id: <20200831152934.1023912-14-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831152934.1023912-1-sashal@kernel.org> References: <20200831152934.1023912-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ofir Bitton [ Upstream commit f1aae40e8dbd2655e3b10cae381a1e8292b19d57 ] In case the driver fails to configure the PCI controller iATU, it needs to unmap the PCI bars before exiting so if the driver is removed, the bars won't be left mapped. Signed-off-by: Ofir Bitton Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay Signed-off-by: Sasha Levin --- drivers/misc/habanalabs/pci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/misc/habanalabs/pci.c b/drivers/misc/habanalabs/pci.c index 9f634ef6f5b37..77022c0b42027 100644 --- a/drivers/misc/habanalabs/pci.c +++ b/drivers/misc/habanalabs/pci.c @@ -378,15 +378,17 @@ int hl_pci_init(struct hl_device *hdev) rc = hdev->asic_funcs->init_iatu(hdev); if (rc) { dev_err(hdev->dev, "Failed to initialize iATU\n"); - goto disable_device; + goto unmap_pci_bars; } rc = hl_pci_set_dma_mask(hdev); if (rc) - goto disable_device; + goto unmap_pci_bars; return 0; +unmap_pci_bars: + hl_pci_bars_unmap(hdev); disable_device: pci_clear_master(pdev); pci_disable_device(pdev); -- 2.25.1