From: Greg KH <gregkh@linuxfoundation.org>
To: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: linux-serial@vger.kernel.org, jacmet@sunsite.dk, git@xilinx.com
Subject: Re: [PATCH 1/2] tty: serial: uartlite: Disable clocks in case of errors
Date: Tue, 25 May 2021 10:15:56 +0200 [thread overview]
Message-ID: <YKyyPB7JjPd25uiL@kroah.com> (raw)
In-Reply-To: <1621929844-19727-2-git-send-email-shubhrajyoti.datta@xilinx.com>
On Tue, May 25, 2021 at 01:34:03PM +0530, Shubhrajyoti Datta wrote:
> In case the uart registration fails the clocks are left enabled.
> Disable the clock in case of errors.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
> drivers/tty/serial/uartlite.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
> index f42ccc4..39ea495 100644
> --- a/drivers/tty/serial/uartlite.c
> +++ b/drivers/tty/serial/uartlite.c
> @@ -799,7 +799,7 @@ static int ulite_probe(struct platform_device *pdev)
> ret = uart_register_driver(&ulite_uart_driver);
> if (ret < 0) {
> dev_err(&pdev->dev, "Failed to register driver\n");
> - return ret;
> + goto err_out_clk_disable;
> }
> }
>
> @@ -808,6 +808,10 @@ static int ulite_probe(struct platform_device *pdev)
> clk_disable(pdata->clk);
>
> return ret;
> +
> +err_out_clk_disable:
> + clk_disable_unprepare(pdata->clk);
Why not put this above in your error code?
Also, are you sure that you are calling uart_register_driver() in the
correct place? Shouldn't everything be set up before it is called? You
have more logic after it is called, what happens if your device is
opened before the uart_register_driver() call returns?
thanks,
greg k-h
next prev parent reply other threads:[~2021-05-25 8:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 8:04 [PATCH 0/2] tty: serial: uartlite: PM Runtime Shubhrajyoti Datta
2021-05-25 8:04 ` [PATCH 1/2] tty: serial: uartlite: Disable clocks in case of errors Shubhrajyoti Datta
2021-05-25 8:15 ` Greg KH [this message]
2021-05-25 8:04 ` [PATCH 2/2] tty: serial: uartlite: Add runtime pm support Shubhrajyoti Datta
2021-05-25 8:13 ` Greg KH
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=YKyyPB7JjPd25uiL@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=git@xilinx.com \
--cc=jacmet@sunsite.dk \
--cc=linux-serial@vger.kernel.org \
--cc=shubhrajyoti.datta@xilinx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.