Skip to content

Commit 04ba6b7

Browse files
committed
Merge branch 'net-ethernet-ti-fix-some-return-value-check'
Wei Yongjun says: ==================== net: ethernet: ti: fix some return value check This patchset convert cpsw_ale_create() to return PTR_ERR() only, and changed all the caller to check IS_ERR() instead of NULL. Since v2: 1) rebased on net.git, as Jakub's suggest 2) split am65-cpsw-nuss.c changes, as Grygorii's suggest ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents d28ea1f + 1401cf6 commit 04ba6b7

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,8 +1895,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
18951895
ale_params.nu_switch_ale = true;
18961896

18971897
common->ale = cpsw_ale_create(&ale_params);
1898-
if (!common->ale) {
1898+
if (IS_ERR(common->ale)) {
18991899
dev_err(dev, "error initializing ale engine\n");
1900+
ret = PTR_ERR(common->ale);
19001901
goto err_of_clear;
19011902
}
19021903

drivers/net/ethernet/ti/cpsw_ale.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
955955

956956
ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL);
957957
if (!ale)
958-
return NULL;
958+
return ERR_PTR(-ENOMEM);
959959

960960
ale->p0_untag_vid_mask =
961961
devm_kmalloc_array(params->dev, BITS_TO_LONGS(VLAN_N_VID),

drivers/net/ethernet/ti/cpsw_priv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,9 +490,9 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs,
490490
ale_params.ale_ports = CPSW_ALE_PORTS_NUM;
491491

492492
cpsw->ale = cpsw_ale_create(&ale_params);
493-
if (!cpsw->ale) {
493+
if (IS_ERR(cpsw->ale)) {
494494
dev_err(dev, "error initializing ale engine\n");
495-
return -ENODEV;
495+
return PTR_ERR(cpsw->ale);
496496
}
497497

498498
dma_params.dev = dev;

drivers/net/ethernet/ti/netcp_ethss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3704,9 +3704,9 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
37043704
ale_params.nu_switch_ale = true;
37053705
}
37063706
gbe_dev->ale = cpsw_ale_create(&ale_params);
3707-
if (!gbe_dev->ale) {
3707+
if (IS_ERR(gbe_dev->ale)) {
37083708
dev_err(gbe_dev->dev, "error initializing ale engine\n");
3709-
ret = -ENODEV;
3709+
ret = PTR_ERR(gbe_dev->ale);
37103710
goto free_sec_ports;
37113711
} else {
37123712
dev_dbg(gbe_dev->dev, "Created a gbe ale engine\n");

0 commit comments

Comments
 (0)