Skip to content

Commit 47b95e8

Browse files
Wei Yongjungregkh
authored andcommitted
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: b7e2b53 ("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>
1 parent 6e124e5 commit 47b95e8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/tty/serial/mvebu-uart.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,8 +1382,8 @@ static int mvebu_uart_clock_probe(struct platform_device *pdev)
13821382
*/
13831383
uart_clock_base->reg1 = devm_ioremap(dev, res->start,
13841384
resource_size(res));
1385-
if (IS_ERR(uart_clock_base->reg1))
1386-
return PTR_ERR(uart_clock_base->reg1);
1385+
if (!uart_clock_base->reg1)
1386+
return -ENOMEM;
13871387

13881388
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
13891389
if (!res) {
@@ -1401,8 +1401,8 @@ static int mvebu_uart_clock_probe(struct platform_device *pdev)
14011401
*/
14021402
uart_clock_base->reg2 = devm_ioremap(dev, res->start,
14031403
resource_size(res));
1404-
if (IS_ERR(uart_clock_base->reg2))
1405-
return PTR_ERR(uart_clock_base->reg2);
1404+
if (!uart_clock_base->reg2)
1405+
return -ENOMEM;
14061406

14071407
hw_clk_data = devm_kzalloc(dev,
14081408
struct_size(hw_clk_data, hws,

0 commit comments

Comments
 (0)