Skip to content

Commit

Permalink
fpga: altera-cvp: Fix registration for CvP incapable devices
Browse files Browse the repository at this point in the history
The probe function needs to verify the CvP enable bit in order to
properly determine if FPGA Manager functionality can be safely
enabled.

Fixes: 34d1dc1 ("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]>
Acked-by: Alan Tull <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Andreas Puhm authored and gregkh committed Nov 11, 2018
1 parent ae66864 commit 68f6053
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/fpga/altera-cvp.c
Original file line number Diff line number Diff line change
@@ -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;

/*
@@ -416,6 +417,14 @@ static int altera_cvp_probe(struct pci_dev *pdev,
return -ENODEV;
}

pci_read_config_dword(pdev, VSE_CVP_STATUS, &regval);
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;

0 comments on commit 68f6053

Please sign in to comment.