summaryrefslogtreecommitdiff
path: root/src/ec/kontron/kempld/kempld.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2022-05-26 19:05:52 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-06-22 08:55:15 +0000
commit49b3f848202052f2ad11179f813cba9eaa1250af (patch)
treee8f13c755c7a5fcf7af95b453c18d345b678f52f /src/ec/kontron/kempld/kempld.c
parente607ddc5c9c9053cab0ff3ec8d807a69ebbe3e9c (diff)
ec/kontron/kempld: Fix IORESOURCE_IRQ
The IRQ was incorrecly allocated as IO resource. It's not possible for new_resource() to return NULL. Change-Id: I66811b36b44f06cb39df8e9cdab87be0e2ef8eb9 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64699 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/ec/kontron/kempld/kempld.c')
-rw-r--r--src/ec/kontron/kempld/kempld.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ec/kontron/kempld/kempld.c b/src/ec/kontron/kempld/kempld.c
index 31d927d029..9527429e0e 100644
--- a/src/ec/kontron/kempld/kempld.c
+++ b/src/ec/kontron/kempld/kempld.c
@@ -12,12 +12,9 @@ static void kempld_uart_read_resources(struct device *dev)
static const unsigned int io_addr[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
const struct ec_kontron_kempld_config *const config = dev->chip_info;
-
- struct resource *const res_io = new_resource(dev, 0);
- struct resource *const res_irq = new_resource(dev, 1);
const unsigned int uart = dev->path.generic.subid;
- if (!config || !res_io || !res_irq || uart >= KEMPLD_NUM_UARTS)
+ if (!config || uart >= KEMPLD_NUM_UARTS)
return;
const enum kempld_uart_io io = config->uart[uart].io;
@@ -34,13 +31,16 @@ static void kempld_uart_read_resources(struct device *dev)
return;
}
+ struct resource *res_io = new_resource(dev, 0);
res_io->base = io_addr[io];
res_io->size = 8;
res_io->flags = IORESOURCE_IO | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_ASSIGNED;
+
+ struct resource *res_irq = new_resource(dev, 1);
res_irq->base = irq;
res_irq->size = 1;
- res_irq->flags = IORESOURCE_IO | IORESOURCE_FIXED |
+ res_irq->flags = IORESOURCE_IRQ | IORESOURCE_FIXED |
IORESOURCE_STORED | IORESOURCE_ASSIGNED;
if (kempld_get_mutex(100) < 0)