mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Maxim Kochetkov <fido_max@inbox.ru>, barebox@lists.infradead.org
Cc: pmamonov@gmail.com, a.kuyan@yadro.com, p.mamonov@yadro.com
Subject: Re: [PATCH v2 1/1] serial: ns16550: move iomem/ioport init after clock init
Date: Fri, 17 Feb 2023 15:12:52 +0100	[thread overview]
Message-ID: <f0169ae5-22aa-6acb-d020-e3b10912d8f9@pengutronix.de> (raw)
In-Reply-To: <20230217140501.56964-1-fido_max@inbox.ru>

On 17.02.23 15:05, Maxim Kochetkov wrote:
> While probing ns16550 clock provider may be unavailable and
> clk_get() returns -EPROBE_DEFER. Next ns16550_probe() attempts
> will be failed too because of dev_request_mem_resource() has already
> acquired this resource for the device and returns -EBUSY.
> So move resource allocation just after clock init. It will let proper
> probe for defered clocks on boards with deep probe disabled.
> 
> Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
> ---
>  drivers/serial/serial_ns16550.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
> index 16f3576645..bbf783f662 100644
> --- a/drivers/serial/serial_ns16550.c
> +++ b/drivers/serial/serial_ns16550.c
> @@ -479,13 +479,6 @@ static int ns16550_probe(struct device *dev)
>  
>  	priv = xzalloc(sizeof(*priv));
>  
> -	ret = ns16550_init_iomem(dev, priv);
> -	if (ret)
> -		ret = ns16550_init_ioport(dev, priv);
> -
> -	if (ret)
> -		return ret;
> -
>  	if (plat)
>  		priv->plat = *plat;
>  	else
> @@ -511,6 +504,13 @@ static int ns16550_probe(struct device *dev)
>  		goto err;
>  	}
>  
> +	ret = ns16550_init_iomem(dev, priv);
> +	if (ret)
> +		ret = ns16550_init_ioport(dev, priv);
> +
> +	if (ret)
> +		return ret;

Sorry should've looked closer :/
This should be goto err like in the code above as not to leak
memory.

> +
>  	cdev = &priv->cdev;
>  	cdev->dev = dev;
>  	cdev->tstc = ns16550_tstc;

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




      reply	other threads:[~2023-02-17 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 14:05 Maxim Kochetkov
2023-02-17 14:12 ` Ahmad Fatoum [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=f0169ae5-22aa-6acb-d020-e3b10912d8f9@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=a.kuyan@yadro.com \
    --cc=barebox@lists.infradead.org \
    --cc=fido_max@inbox.ru \
    --cc=p.mamonov@yadro.com \
    --cc=pmamonov@gmail.com \
    /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