[PATCH 05/29] serial: mtk: initial priv data before using

Stefan Roese sr at denx.de
Wed Jul 19 11:54:20 CEST 2023


On 7/19/23 11:16, Weijie Gao wrote:
> This patch ensures driver private data being fully initialized in
> _debug_uart_init which is not covered by .priv_auto ops.
> 
> Signed-off-by: Sam Shih <sam.shih at mediatek.com>
> Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> ---
>   drivers/serial/serial_mtk.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c
> index ded7346a13..2dffa14ea7 100644
> --- a/drivers/serial/serial_mtk.c
> +++ b/drivers/serial/serial_mtk.c
> @@ -439,6 +439,7 @@ static inline void _debug_uart_init(void)
>   {
>   	struct mtk_serial_priv priv;
>   
> +	memset(&priv, 0, sizeof(struct mtk_serial_priv));
>   	priv.regs = (void *) CONFIG_VAL(DEBUG_UART_BASE);
>   	priv.fixed_clk_rate = CONFIG_DEBUG_UART_CLOCK;
>   

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan


More information about the U-Boot mailing list