Re: [PATCH v2] serial: liteuart: fix missing drvdata
From: Johan Hovold <johan@kernel.org>
Date: 2021-11-15 13:50:00
On Mon, Nov 15, 2021 at 10:54:58AM +0100, Ilia Sergachev wrote:
quoted hunk ↗ jump to hunk
drvdata has to be set in _probe() - otherwise platform_get_drvdata() causes null pointer dereference BUG in _remove() Fixes: 1da81e5562fa ("drivers/tty/serial: add LiteUART driver") Signed-off-by: Ilia Sergachev <redacted> --- v1 -> v2: add Fixes: 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); }
Looks good: Reviewed-by: Johan Hovold <johan@kernel.org> There are more issues with driver unbind than this though as the port is never deregistered. I've fixed it up on top of this patch: https://lore.kernel.org/r/20211115133745.11445-1-johan@kernel.org (local) Johan