# Re: \[PATCH\] serial: liteuart: fix missing drvdata

- From: Greg Kroah-Hartman \<gregkh@linuxfoundation.org\>
- Date: 2021-11-15 07:02:31 
- List: linux-serial
- Page: https://ratatoskr.run/linux-serial/2021/11/16405163
- Thread: https://ratatoskr.run/linux-serial/2021/11/16405162/t.md

```text
On Mon, Nov 15, 2021 at 03:18:08AM +0100, Ilia Sergachev wrote:
> drvdata has to be set in _probe() - otherwise platform_get_drvdata()
> causes null pointer dereference BUG in _remove()
> 
> Signed-off-by: Ilia Sergachev <redacted>
> ---
>  drivers/tty/serial/liteuart.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/serial/liteuart.c b/drivers/tty/serial/liteuart.c
> index dbc0559a9157..f075f4ff5fcf 100644
> --- a/drivers/tty/serial/liteuart.c
> +++ b/drivers/tty/serial/liteuart.c
> @@ -285,6 +285,8 @@ static int liteuart_probe(struct platform_device *pdev)
>  	port->line = dev_id;
>  	spin_lock_init(&port->lock);
>  
> +	platform_set_drvdata(pdev, port);
> +
>  	return uart_add_one_port(&liteuart_driver, &uart->port);
>  }
>  
> -- 
> 2.25.1

What commit does this fix?

thanks,

greg k-h
```
