Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: lan966x: fix a IS_ERR() vs NULL check in lan966x_create_targets()

The devm_ioremap() function does not return error pointers. It returns
NULL.

Fixes: db8bcaad5393 ("net: lan966x: add the basic lan966x driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Dan Carpenter and committed by
David S. Miller
bb14bfc7 f6882b8f

+2 -2
+2 -2
drivers/net/ethernet/microchip/lan966x/lan966x_main.c
··· 83 83 begin[idx] = devm_ioremap(&pdev->dev, 84 84 iores[idx]->start, 85 85 resource_size(iores[idx])); 86 - if (IS_ERR(begin[idx])) { 86 + if (!begin[idx]) { 87 87 dev_err(&pdev->dev, "Unable to get registers: %s\n", 88 88 iores[idx]->name); 89 - return PTR_ERR(begin[idx]); 89 + return -ENOMEM; 90 90 } 91 91 } 92 92