Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/34582 )
Change subject: soc/intel/common/block/uart: Update the UART PCI device reference ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/34582/1/src/soc/intel/cannonlake/ua... File src/soc/intel/cannonlake/uart.c:
https://review.coreboot.org/c/coreboot/+/34582/1/src/soc/intel/cannonlake/ua... PS1, Line 53: struct device *soc_uart_console_to_device(int uart_console)
Plus, I don't see the functions manipulating the value returned by soc_uart_console_to_device and merely consuming it for the device reference.
If that's the case, please use `const` in the whole chain.
Generally, I think it's sometimes ok to cast a `const` away. But only if you use it to call very local functions that are unlikely to change ever.
If you cast a `const` away and pass that pointer through an API to other compilation units, all hope is lost (read as: highest possible risk).
https://review.coreboot.org/c/coreboot/+/34582/1/src/soc/intel/common/block/... File src/soc/intel/common/block/uart/uart.c:
https://review.coreboot.org/c/coreboot/+/34582/1/src/soc/intel/common/block/... PS1, Line 146: uart_get_device Missing NULL check.