mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-11 07:03:09 -04:00
staging: comedi: jr3_pci: check PCI BAR 0 size
The various supported boards have different numbers of subdevices from 1 to 4. Each subdevice needs a block of registers in PCI BAR 0. Check the region is large enough for the required number of subdevices. Return an error from `jr3_pci_auto_attach()` if it is too small. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7cb1c5c2cd
commit
8abde9acdf
1 changed files with 3 additions and 0 deletions
|
|
@ -705,6 +705,9 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (pci_resource_len(pcidev, 0) < board->n_subdevs * sizeof(*block))
|
||||
return -ENXIO;
|
||||
|
||||
dev->mmio = pci_ioremap_bar(pcidev, 0);
|
||||
if (!dev->mmio)
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
Loading…
Reference in a new issue