From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: Cyrille Pitchen <cyrille.pitchen@atmel.com>,
gregkh@linuxfoundation.org, wenyou.yang@atmel.com,
ludovic.desroches@atmel.com, leilei.zhao@atmel.com,
voice.shen@atmel.com, josh.wu@atmel.com,
linux-serial@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 3/5] tty/serial: at91: fix error handling in atmel_serial_probe()
Date: Fri, 9 Jan 2015 16:28:58 +0100 [thread overview]
Message-ID: <54AFF3BA.7090704@atmel.com> (raw)
In-Reply-To: <95ff85410e2f93993a4f7c5d255c4a88993fd462.1418131298.git.cyrille.pitchen@atmel.com>
Le 09/12/2014 14:31, Cyrille Pitchen a écrit :
> -EDEFER error wasn't handle properly by atmel_serial_probe().
> As an example, when atmel_serial_probe() is called for the first time, we pass
> the test_and_set_bit() test to check whether the port has already been
> initalized. Then we call atmel_init_port(), which may return -EDEFER, possibly
> returned before by clk_get(). Consequently atmel_serial_probe() used to return
> this error code WITHOUT clearing the port bit in the "atmel_ports_in_use" mask.
> When atmel_serial_probe() was called for the second time, it used to fail on
> the test_and_set_bit() function then returning -EBUSY.
>
> When atmel_serial_probe() fails, this patch make it clear the port bit in the
> "atmel_ports_in_use" mask, if needed, before returning the error code.
>
> Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
and you can also add:
Cc: <stable@vger.kernel.org> # 3.12+
Thanks.
> ---
> drivers/tty/serial/atmel_serial.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index c6621dc..92a8b26 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -2565,7 +2565,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
>
> ret = atmel_init_port(port, pdev);
> if (ret)
> - goto err;
> + goto err_clear_bit;
>
> if (!atmel_use_pdc_rx(&port->uart)) {
> ret = -ENOMEM;
> @@ -2628,6 +2628,8 @@ err_alloc_ring:
> clk_put(port->clk);
> port->clk = NULL;
> }
> +err_clear_bit:
> + clear_bit(port->uart.line, atmel_ports_in_use);
> err:
> return ret;
> }
>
--
Nicolas Ferre
next prev parent reply other threads:[~2015-01-09 15:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-09 13:31 [PATCH 0/5] tty/serial: at91: fix atmel_serial_probe(), dma_sync_* and the Hardware Handshaking support Cyrille Pitchen
2014-12-09 13:31 ` [PATCH 1/5] tty/serial: at91: use correct type for dma_sync_*_for_cpu() and dma_sync_*_for_device() Cyrille Pitchen
2015-01-09 15:13 ` Nicolas Ferre
2015-01-09 22:19 ` Greg KH
2014-12-09 13:31 ` [PATCH 2/5] tty/serial: at91: enable peripheral clock before accessing I/O registers Cyrille Pitchen
2015-01-09 15:12 ` Nicolas Ferre
2014-12-09 13:31 ` [PATCH 3/5] tty/serial: at91: fix error handling in atmel_serial_probe() Cyrille Pitchen
2015-01-09 15:28 ` Nicolas Ferre [this message]
2014-12-09 13:31 ` [PATCH 4/5] tty/serial: at91: fix RTS line management when hardware handshake is enabled Cyrille Pitchen
2015-01-09 15:40 ` Nicolas Ferre
2014-12-09 13:31 ` [PATCH 5/5] tty/serial: at91: fix typo and indentation Cyrille Pitchen
2015-01-09 15:41 ` Nicolas Ferre
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=54AFF3BA.7090704@atmel.com \
--to=nicolas.ferre@atmel.com \
--cc=cyrille.pitchen@atmel.com \
--cc=gregkh@linuxfoundation.org \
--cc=josh.wu@atmel.com \
--cc=leilei.zhao@atmel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=voice.shen@atmel.com \
--cc=wenyou.yang@atmel.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;
as well as URLs for NNTP newsgroup(s).