There is an error path in mcb_pci_probe() where
it returns zero instead of error code.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If a MCB PCI Carrier device is IO mapped insted of memory-mapped,
the memory of the PCI device is still not unmapped.
Also the patch adds deallocation of the bus
if chameleon_parse_cells() fails.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The code here is checking for IS_ERR() when request_mem_region() only
returns NULL on error and never an ERR_PTR.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
If a MCB PCI Carrier device is IO mapped insted of memory-mapped (which is
currently unsupported by the upstream driver) the probe function bails out
with -ENOTSUPP.
In this case the memory of the PCI device was not unmapped.
Also rename error label to reflect what will happen at the destination (suggested
by Julia Lawall <julia.lawall@lip6.fr>.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently it is not possible to have a kernel with built-in MCB attached
devices. This results out of the fact that mcb-pci requests PCI BAR 0, then
parses the chameleon table and calls the driver's probe function before
releasing BAR 0 again. When building the kernel with modules this is not a
problem (and therefore it wasn't detected by my tests yet).
A solution is to only remap the 1st 0x200 bytes of a Chameleon PCI device.
0x200 bytes is the maximum size of a Chameleon v2 Table.
Also this patch stops disabling the PCI device on successful registration of MCB
devices.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add support for shared PCI IRQs to mcb and mcb-pci.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
chameleon_parse_cells() bails out if chameleon descriptor type is
invalid but does not free the storage 'header' points to.
Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Make mcb depend on HAS_IOMEM and mcb-pci depend on PCI. This fixes build errors
discovered by the 0-day kernel build testing system.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Coverage builds found this build fail in ARM ebsa110_defconfig:
drivers/mcb/mcb-parse.c: In function 'chameleon_parse_cells':
drivers/mcb/mcb-parse.c:105:2: error: implicit declaration of function 'memcpy_fromio' [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [drivers/mcb/mcb-parse.o] Error 1
A simple bisect will output this:
3764e82e51 is the first bad commit
commit 3764e82e51
Author: Johannes Thumshirn <johannes.thumshirn@men.de>
Date: Wed Feb 26 17:29:05 2014 +0100
drivers: Introduce MEN Chameleon Bus
The above commit used "default m" which is wrong. New drivers
should never be globally enabled with "default y/m". Whether
this driver makes sense to build on ARM is an independent issue.
Here we delete the "default m" line, which is the equivalent of
"default n".
Cc: Johannes Thumshirn <johannes.thumshirn@men.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add support for MCB over PCI devices. Both PCI attached on-board Chameleon FPGAs
as well as CompactPCI based MCB carrier cards are supported with this driver.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The MCB (MEN Chameleon Bus) is a Bus specific to MEN Mikroelektronik
FPGA based devices. It is used to identify MCB based IP-Cores within
an FPGA and provide the necessary framework for instantiating drivers
for these devices.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>