serial: mvebu-uart: fix return value check in mvebu_uart_clock_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Tue, 1 Mar 2022 07:58:06 +0000 (07:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Mar 2022 21:17:10 +0000 (22:17 +0100)
In case of error, the function devm_ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should
be replaced with NULL test.

Fixes: b7e2b5360f9b ("serial: mvebu-uart: implement UART clock driver for configuring UART base clock")
Reported-by: Hulk Robot <hulkci@huawei.com>
Reviewed-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20220301075806.3950108-1-weiyongjun1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mvebu-uart.c

index 2e92638..45976e2 100644 (file)
@@ -1382,8 +1382,8 @@ static int mvebu_uart_clock_probe(struct platform_device *pdev)
         */
        uart_clock_base->reg1 = devm_ioremap(dev, res->start,
                                             resource_size(res));
-       if (IS_ERR(uart_clock_base->reg1))
-               return PTR_ERR(uart_clock_base->reg1);
+       if (!uart_clock_base->reg1)
+               return -ENOMEM;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
        if (!res) {
@@ -1401,8 +1401,8 @@ static int mvebu_uart_clock_probe(struct platform_device *pdev)
         */
        uart_clock_base->reg2 = devm_ioremap(dev, res->start,
                                             resource_size(res));
-       if (IS_ERR(uart_clock_base->reg2))
-               return PTR_ERR(uart_clock_base->reg2);
+       if (!uart_clock_base->reg2)
+               return -ENOMEM;
 
        hw_clk_data = devm_kzalloc(dev,
                                   struct_size(hw_clk_data, hws,