diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2022-03-01 10:58:06 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-03-02 00:17:10 +0300 |
commit | 47b95e8ab731511b7ed7924ec3ec922e14737e4e (patch) | |
tree | 3faccc46a208a4fcc321d657f40e91190c09fe74 /drivers/tty/serial/mvebu-uart.c | |
parent | 6e124e58ae2e0e3f6400dce21e942a94a67a7949 (diff) | |
download | linux-47b95e8ab731511b7ed7924ec3ec922e14737e4e.tar.xz |
serial: mvebu-uart: fix return value check in mvebu_uart_clock_probe()
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>
Diffstat (limited to 'drivers/tty/serial/mvebu-uart.c')
-rw-r--r-- | drivers/tty/serial/mvebu-uart.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c index 2e9263888ddc..45976e2140d4 100644 --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -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, |