From 49b3f848202052f2ad11179f813cba9eaa1250af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Thu, 26 May 2022 19:05:52 +0300 Subject: [PATCH] ec/kontron/kempld: Fix IORESOURCE_IRQ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64699 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Nico Huber --- src/ec/kontron/kempld/kempld.c | 10 +++++----- 1 file 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)