sc16is7xx: remove ports on probe error path
authorJakub Kicinski <kubakici@wp.pl>
Mon, 16 Mar 2015 23:28:46 +0000 (00:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 21:38:36 +0000 (22:38 +0100)
If ports are not explicitly removed on the error path
the device will not get properly unregistered leaving
/dev/ttySC* nodes in the filesystem.

Signed-off-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Jon Ringle <jringle@gridpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sc16is7xx.c

index df9a384dfbdaab9a6d953b1c36a50ba0c30989ae..11bb44039a57276219b4913c613ccb66af472261 100644 (file)
@@ -1120,6 +1120,9 @@ static int sc16is7xx_probe(struct device *dev,
        if (!ret)
                return 0;
 
+       for (i = 0; i < s->uart.nr; i++)
+               uart_remove_one_port(&s->uart, &s->p[i].port);
+
        mutex_destroy(&s->mutex);
 
 #ifdef CONFIG_GPIOLIB