]> git.karo-electronics.de Git - linux-beck.git/commit
tty/serial: at91: fix error handling in atmel_serial_probe()
authorCyrille Pitchen <cyrille.pitchen@atmel.com>
Tue, 9 Dec 2014 13:31:34 +0000 (14:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jan 2015 22:20:49 +0000 (14:20 -0800)
commit6fbb9bdf0f3fbe23aeff806489791aa876adaffb
tree2fca43a968f23a299c29c0382d33599300076f3b
parentd4f641876a68d1961e30c202709cc2d484f69f6f
tty/serial: at91: fix error handling in atmel_serial_probe()

-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>
Cc: <stable@vger.kernel.org> # 3.12+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/atmel_serial.c