public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Ilia Sergachev <silia@ethz.ch>
Cc: linux-serial@vger.kernel.org, Karol Gugala <kgugala@antmicro.com>,
	Mateusz Holenko <mholenko@antmicro.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v2] serial: liteuart: fix missing drvdata
Date: Mon, 15 Nov 2021 14:49:42 +0100	[thread overview]
Message-ID: <YZJldkD/yxZtoANS@hovoldconsulting.com> (raw)
In-Reply-To: <20211115105458.6407e1aa@dtkw>

On Mon, Nov 15, 2021 at 10:54:58AM +0100, Ilia Sergachev wrote:
> 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 <silia@ethz.ch>
> ---
> 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

Johan

      reply	other threads:[~2021-11-15 13:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  9:54 [PATCH v2] serial: liteuart: fix missing drvdata Ilia Sergachev
2021-11-15 13:49 ` Johan Hovold [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZJldkD/yxZtoANS@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=kgugala@antmicro.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=mholenko@antmicro.com \
    --cc=silia@ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox