serial: sh-sci: Add missing call to uart_remove_one_port() in failure path
authorGeert Uytterhoeven <geert+renesas@linux-m68k.org>
Fri, 28 Feb 2014 13:21:33 +0000 (14:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 1 Mar 2014 00:39:38 +0000 (16:39 -0800)
If cpufreq_register_notifier() fails, we have to remove the port added by
sci_probe_single(), which is not done by sci_cleanup_single().

Else the serial port stays active from the point of view of the serial
subsystem, and it may crash when userspace getty is started, or when the
loadable driver module is unloaded.

This was introduced by commit 6dae14216c85eea13db7b12c469475c5d30e5499
("serial: sh-sci: Fix probe error paths").

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index 1668523d31fb5a26c4b0a69988c267a9e0e13009..0cb52376f97d634921f01fc9d9fb9a97a2c7a579 100644 (file)
@@ -2564,6 +2564,7 @@ static int sci_probe(struct platform_device *dev)
        ret = cpufreq_register_notifier(&sp->freq_transition,
                                        CPUFREQ_TRANSITION_NOTIFIER);
        if (unlikely(ret < 0)) {
+               uart_remove_one_port(&sci_uart_driver, &sp->port);
                sci_cleanup_single(sp);
                return ret;
        }