John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
drivers/uart: Fix control flow DEADCODE issue
Coverity detects the irq_gpio_index DEADCODE which is initialized as -1. This change updates irq_gpio_index based on irq_gpio.pin_count which differentiates gpio irq or pirq.
Found-by: Coverity CID 1429983 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I79f85f05b78e5569615ae4c4f7c81cc85c3999c9 --- M src/drivers/uart/acpi/acpi.c 1 file changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46506/1
diff --git a/src/drivers/uart/acpi/acpi.c b/src/drivers/uart/acpi/acpi.c index f9d9d8f..df26f4e 100644 --- a/src/drivers/uart/acpi/acpi.c +++ b/src/drivers/uart/acpi/acpi.c @@ -73,8 +73,10 @@ acpi_device_write_uart(&config->uart);
/* Use either Interrupt() or GpioInt() */ - if (config->irq_gpio.pin_count) + if (config->irq_gpio.pin_count) { acpi_device_write_gpio(&config->irq_gpio); + irq_gpio_index++; + } else acpi_device_write_interrupt(&config->irq);
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46506/1/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/1/src/drivers/uart/acpi/acpi.... PS1, Line 78: irq_gpio_index++; Why increment it?
https://review.coreboot.org/c/coreboot/+/46506/1/src/drivers/uart/acpi/acpi.... PS1, Line 80: else The `else` should have braces too.
Hello build bot (Jenkins), Tim Wawrzynczak, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46506
to look at the new patch set (#2).
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
drivers/uart: Fix control flow DEADCODE issue
Coverity detects the irq_gpio_index DEADCODE which is initialized as -1. This change updates irq_gpio_index based on irq_gpio.pin_count which differentiates gpio irq or pirq.
Found-by: Coverity CID 1429983 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I79f85f05b78e5569615ae4c4f7c81cc85c3999c9 --- M src/drivers/uart/acpi/acpi.c 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46506/2
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46506/2/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/2/src/drivers/uart/acpi/acpi.... PS2, Line 80: else { else should follow close brace '}'
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/46506/1/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/1/src/drivers/uart/acpi/acpi.... PS1, Line 78: irq_gpio_index++;
Why increment it?
The irq_gpio_index increment is similar to reset_gpio_index and enable_gpio_index handling in uart_acpi_write_gpio as long as gpio->pin_count is not 0.
https://review.coreboot.org/c/coreboot/+/46506/1/src/drivers/uart/acpi/acpi.... PS1, Line 80: else
The `else` should have braces too.
Ack
Hello build bot (Jenkins), Tim Wawrzynczak, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46506
to look at the new patch set (#3).
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
drivers/uart: Fix control flow DEADCODE issue
Coverity detects the irq_gpio_index DEADCODE which is initialized as -1. This change updates irq_gpio_index based on irq_gpio.pin_count which differentiates gpio irq or pirq.
Found-by: Coverity CID 1429983 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I79f85f05b78e5569615ae4c4f7c81cc85c3999c9 --- M src/drivers/uart/acpi/acpi.c 1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46506/3
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46506/2/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/2/src/drivers/uart/acpi/acpi.... PS2, Line 77: acpi_device_write_gpio(&config->irq_gpio); : irq_gpio_index++; Reading back over what this is doing, even though this is the first pin added, it's probably best to do what the other pins are doing, e.g.: ``` irq_gpio_index = uart_acpi_write_gpio(&config->irq_gpio, &curr_index); ``` since curr_index is used as state between calls to uart_acpi_write_gpio
Hello build bot (Jenkins), Tim Wawrzynczak, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46506
to look at the new patch set (#4).
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
drivers/uart: Fix control flow DEADCODE issue
Coverity detects the irq_gpio_index DEADCODE which is initialized as -1. This change updates irq_gpio_index based on irq_gpio.pin_count which differentiates gpio irq or pirq.
Found-by: Coverity CID 1429983 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I79f85f05b78e5569615ae4c4f7c81cc85c3999c9 --- M src/drivers/uart/acpi/acpi.c 1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46506/4
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46506/2/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/2/src/drivers/uart/acpi/acpi.... PS2, Line 77: acpi_device_write_gpio(&config->irq_gpio); : irq_gpio_index++;
Reading back over what this is doing, even though this is the first pin added, it's probably best to […]
Ack
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46506/4/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/4/src/drivers/uart/acpi/acpi.... PS4, Line 81: acpi_device_write_interrupt(&config->irq); From https://doc.coreboot.org/coding_style.html#placing-braces-and-spaces:
This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:
Hello build bot (Jenkins), Tim Wawrzynczak, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46506
to look at the new patch set (#5).
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
drivers/uart: Fix control flow DEADCODE issue
Coverity detects the irq_gpio_index DEADCODE which is initialized as -1. This change updates irq_gpio_index based on irq_gpio.pin_count which differentiates gpio irq or pirq.
Found-by: Coverity CID 1429983 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I79f85f05b78e5569615ae4c4f7c81cc85c3999c9 --- M src/drivers/uart/acpi/acpi.c 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/46506/5
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46506/4/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/4/src/drivers/uart/acpi/acpi.... PS4, Line 81: acpi_device_write_interrupt(&config->irq);
From https://doc.coreboot.org/coding_style.html#placing-braces-and-spaces: […]
Ack
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46506 )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Patch Set 5:
(1 comment)
Furquan, Duncan, is this a bug in this driver or
https://review.coreboot.org/c/coreboot/+/46506/5/src/drivers/uart/acpi/acpi.... File src/drivers/uart/acpi/acpi.c:
https://review.coreboot.org/c/coreboot/+/46506/5/src/drivers/uart/acpi/acpi.... PS5, Line 75: /* Use either Interrupt() or GpioInt() */ : if (config->irq_gpio.pin_count) { : acpi_device_write_gpio(&config->irq_gpio); : irq_gpio_index = uart_acpi_write_gpio(&config->irq_gpio, : &curr_index); : } else { : acpi_device_write_interrupt(&config->irq); : } : : /* Add enable/reset GPIOs if needed */ : if (uart_acpi_add_gpios_to_crs(config)) { : reset_gpio_index = uart_acpi_write_gpio(&config->reset_gpio, : &curr_index); : enable_gpio_index = uart_acpi_write_gpio(&config->enable_gpio, : &curr_index); : } Actually, I see the GPIOs are only added conditionally to _CRS, so I think it would actually need to be: ``` /* Use either Interrupt() or GpioInt() */ if (!config->irq_gpio.pin_count) acpi_device_write_interrupt(&config->irq);
/* Add enable/reset GPIOs if needed */ if (uart_acpi_add_gpios_to_crs(config)) { irq_gpio_index = uart_acpi_write_gpio(&config->irq_gpio, &curr_index); reset_gpio_index = uart_acpi_write_gpio(&config->reset_gpio, &curr_index); if (config->irq_gpio.pin_count) enable_gpio_index = uart_acpi_write_gpio(&config->enable_gpio, &curr_index); } ```
Furquan, Duncan, does this look right?
Stefan Reinauer has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/46506?usp=email )
Change subject: drivers/uart: Fix control flow DEADCODE issue ......................................................................
Abandoned