[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190211141828.576397110@linuxfoundation.org>
Date: Mon, 11 Feb 2019 15:17:00 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Andreas Puhm <puhm@...gano.at>,
Anatolij Gustschin <agust@...x.de>,
Moritz Fischer <mdf@...nel.org>, Alan Tull <atull@...nel.org>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 4.14 022/205] fpga: altera-cvp: Fix registration for CvP incapable devices
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 68f60538daa4bc3da5d0764d46f391916fba20fd ]
The probe function needs to verify the CvP enable bit in order to
properly determine if FPGA Manager functionality can be safely
enabled.
Fixes: 34d1dc17ce97 ("fpga manager: Add Altera CvP driver")
Signed-off-by: Andreas Puhm <puhm@...gano.at>
Signed-off-by: Anatolij Gustschin <agust@...x.de>
Reviewed-by: Moritz Fischer <mdf@...nel.org>
Acked-by: Alan Tull <atull@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/fpga/altera-cvp.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c
index 00e73d28077c..b7558acd1a66 100644
--- a/drivers/fpga/altera-cvp.c
+++ b/drivers/fpga/altera-cvp.c
@@ -404,6 +404,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,
{
struct altera_cvp_conf *conf;
u16 cmd, val;
+ u32 regval;
int ret;
/*
@@ -417,6 +418,14 @@ static int altera_cvp_probe(struct pci_dev *pdev,
return -ENODEV;
}
+ pci_read_config_dword(pdev, VSE_CVP_STATUS, ®val);
+ if (!(regval & VSE_CVP_STATUS_CVP_EN)) {
+ dev_err(&pdev->dev,
+ "CVP is disabled for this device: CVP_STATUS Reg 0x%x\n",
+ regval);
+ return -ENODEV;
+ }
+
conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL);
if (!conf)
return -ENOMEM;
--
2.19.1
Powered by blists - more mailing lists