]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: ethernet: ti: am65-cpsw-nuss: fix error handling of am65_cpsw_nuss_probe
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 20 May 2020 03:41:16 +0000 (11:41 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 22 May 2020 00:14:18 +0000 (17:14 -0700)
Convert to using IS_ERR() instead of NULL test for cpsw_ale_create()
error handling. Also fix to return negative error code from this error
handling case instead of 0 in.

Fixes: e7364a21077b ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/am65-cpsw-nuss.c

index 2517ffba81788e00a2c8732cd2138337b820a3d4..88f52a2f85b37dbce467a5c7dae940d68de493bf 100644 (file)
@@ -1895,8 +1895,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
        ale_params.nu_switch_ale = true;
 
        common->ale = cpsw_ale_create(&ale_params);
-       if (!common->ale) {
+       if (IS_ERR(common->ale)) {
                dev_err(dev, "error initializing ale engine\n");
+               ret = PTR_ERR(common->ale);
                goto err_of_clear;
        }