fpga: altera-cvp: Fix registration for CvP incapable devices
PATCH v2 1/1 fpga: altera-cvp: Fix registration for CvP incapable devices
From: Andreas Puhm <[email protected]>
The probe function needs to verify the CvP enable bit in order to properly determine if FPGA Manager functionality can be safely enabled.
---
Changes in v2:
- improve Fixes tag
- wrap lines in commit description
drivers/fpga/altera-cvp.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/fpga/altera-cvp.c +9 -0
@@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,struct altera_cvp_conf *conf;struct fpga_manager *mgr;u16 cmd, val; +u32 regval;int ret;/*
@@ -419,6 +420,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 ;
Signature · 1 line
2.17.1
Hi Anatolij, Andreas,
Quoted 9 lines · Anatolij Gustschin
From: Andreas Puhm <[email protected]>
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 <[email protected]>Signed-off-by Anatolij Gustschin <[email protected]>
Quoted 38 lines
---
Changes in v2:
- improve Fixes tag
- wrap lines in commit descriptiondrivers/fpga/altera-cvp.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/fpga/altera-cvp.c +9
-0@@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,struct altera_cvp_conf *conf;struct fpga_manager *mgr;u16 cmd, val; +u32 regval;int ret;/* @@ -419,6 +420,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 ;Signature · 1 line
2.17.1
Thanks,
Moritz
Alan Tull
Acked-byQuoted 10 lines · Moritz Fischer
Hi Anatolij, Andreas,
Quoted 6 lines · Anatolij Gustschin
From: Andreas Puhm <[email protected]>
The probe function needs to verify the CvP enable bit in order to properly determine if FPGA Manager functionality can be safely enabled.
Quoted 5 lines
Quoted 3 lines
Fixes 34d1dc17ce97 ("fpga manager: Add Altera CvP driver")Signed-off-by Andreas Puhm <[email protected]>Signed-off-by Anatolij Gustschin <[email protected]>Reviewed-by Moritz Fischer <[email protected]>
Thanks!
Alan
Quoted 41 lines
Quoted 36 lines
---
Changes in v2:
- improve Fixes tag
- wrap lines in commit descriptiondrivers/fpga/altera-cvp.c | 9 +++++++++ 1 file changed, 9 insertions(+)drivers/fpga/altera-cvp.c +9
-1@@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,struct altera_cvp_conf *conf;struct fpga_manager *mgr;u16 cmd, val; +u32 regval;int ret;/* @@ -419,6 +420,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 ; --Quoted 2 lines
2.17.1
Thanks,
Moritz