Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mcb: mcb-pci: detect IO mapped devices before requesting resources

If the memory region is requested with devm_request_mem_region()
for an IO mapped device it will return an error and mcb-pci will
incorrectly report it with EBUSY code.

Make sure we identify if the reosure is IO mapped and fail early
with a correct ENOTSUPP code.

Reviewed-by: Jose Javier Rodriguez Barbarin <JoseJavier.Rodriguez@duagon.com>
Signed-off-by: Jorge Sanjuan Garcia <jorge.sanjuangarcia@duagon.com>
Link: https://lore.kernel.org/r/20240523103430.423340-1-jorge.sanjuangarcia@duagon.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sanjuán García, Jorge and committed by
Greg Kroah-Hartman
a774c5d1 10724d5d

+8 -8
+8 -8
drivers/mcb/mcb-pci.c
··· 45 45 } 46 46 pci_set_master(pdev); 47 47 48 + flags = pci_resource_flags(pdev, 0); 49 + if (flags & IORESOURCE_IO) { 50 + ret = -ENOTSUPP; 51 + dev_err(&pdev->dev, 52 + "IO mapped PCI devices are not supported\n"); 53 + goto out_disable; 54 + } 55 + 48 56 priv->mapbase = pci_resource_start(pdev, 0); 49 57 if (!priv->mapbase) { 50 58 dev_err(&pdev->dev, "No PCI resource\n"); ··· 73 65 if (!priv->base) { 74 66 dev_err(&pdev->dev, "Cannot ioremap\n"); 75 67 ret = -ENOMEM; 76 - goto out_disable; 77 - } 78 - 79 - flags = pci_resource_flags(pdev, 0); 80 - if (flags & IORESOURCE_IO) { 81 - ret = -ENOTSUPP; 82 - dev_err(&pdev->dev, 83 - "IO mapped PCI devices are not supported\n"); 84 68 goto out_disable; 85 69 } 86 70