summaryrefslogtreecommitdiff
path: root/drivers/misc/pvpanic.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-11 08:30:05 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-11 08:30:05 +0100
commit3dba1da360da5071d013fd0fb8839124104390fa (patch)
tree6e1efe643077ca559fbf0d6c89ac9358e1f8319e /drivers/misc/pvpanic.c
parentd61adf609c48b9e91a84e9a943f0b3bcd84c3cad (diff)
parent7c53f6b671f4aba70ff15e1b05148b10d58c2837 (diff)
Merge 5.11-rc3 into staging-next
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/pvpanic.c')
-rw-r--r--drivers/misc/pvpanic.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c
index 951b37da5e3c..41cab297d66e 100644
--- a/drivers/misc/pvpanic.c
+++ b/drivers/misc/pvpanic.c
@@ -55,12 +55,23 @@ static int pvpanic_mmio_probe(struct platform_device *pdev)
struct resource *res;
res = platform_get_mem_or_io(pdev, 0);
- if (res && resource_type(res) == IORESOURCE_IO)
+ if (!res)
+ return -EINVAL;
+
+ switch (resource_type(res)) {
+ case IORESOURCE_IO:
base = devm_ioport_map(dev, res->start, resource_size(res));
- else
+ if (!base)
+ return -ENOMEM;
+ break;
+ case IORESOURCE_MEM:
base = devm_ioremap_resource(dev, res);
- if (IS_ERR(base))
- return PTR_ERR(base);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+ break;
+ default:
+ return -EINVAL;
+ }
atomic_notifier_chain_register(&panic_notifier_list,
&pvpanic_panic_nb);