serial: uartps: Fix missing unlock on error in cdns_get_id()
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 25 Sep 2018 14:23:21 +0000 (14:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Oct 2018 20:38:58 +0000 (13:38 -0700)
Add the missing unlock before return from function cdns_get_id()
in the error handling case.

Fixes: ae1cca3fa347 ("serial: uartps: Change uart ID port allocation")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/xilinx_uartps.c

index f77200a0f461aa355a997474330ae3e4a2912e10..0e3dae461f71806fd169735c034acc287ef2b173 100644 (file)
@@ -1394,8 +1394,10 @@ static int cdns_get_id(struct platform_device *pdev)
        if (!alias_bitmap_initialized) {
                ret = of_alias_get_alias_list(cdns_uart_of_match, "serial",
                                              alias_bitmap, MAX_UART_INSTANCES);
-               if (ret)
+               if (ret) {
+                       mutex_unlock(&bitmap_lock);
                        return ret;
+               }
 
                alias_bitmap_initialized++;
        }