serial: mvebu-uart: fix return value check in mvebu_uart_clock_probe()
PATCH 1/1 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 <[email protected]>
Signed-off-by Wei Yongjun <[email protected]>
--- drivers/tty/serial/mvebu-uart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/mvebu-uart.c +4 -4
@@ -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,
Quoted 3 lines · On Tuesday 01 March 2022 07:58:06 Wei Yongjun wrote:
In case of error, the function
devm_ioremap()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.
Ou, that is really truth.
Reviewed-by Pali Rohár <[email protected]>
Quoted 34 lines
Fixes b7e2b5360f9b ("serial: mvebu-uart: implement UART clock driver for configuring UART base clock")Reported-by Hulk Robot <[email protected]>Signed-off-by Wei Yongjun <[email protected]>--- drivers/tty/serial/mvebu-uart.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/tty/serial/mvebu-uart.c +4
-4@@ -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,