Commit 04ba6b7d authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents d28ea1fb 1401cf60
...@@ -1895,8 +1895,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) ...@@ -1895,8 +1895,9 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
ale_params.nu_switch_ale = true; ale_params.nu_switch_ale = true;
common->ale = cpsw_ale_create(&ale_params); common->ale = cpsw_ale_create(&ale_params);
if (!common->ale) { if (IS_ERR(common->ale)) {
dev_err(dev, "error initializing ale engine\n"); dev_err(dev, "error initializing ale engine\n");
ret = PTR_ERR(common->ale);
goto err_of_clear; goto err_of_clear;
} }
......
...@@ -955,7 +955,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params) ...@@ -955,7 +955,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL); ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL);
if (!ale) if (!ale)
return NULL; return ERR_PTR(-ENOMEM);
ale->p0_untag_vid_mask = ale->p0_untag_vid_mask =
devm_kmalloc_array(params->dev, BITS_TO_LONGS(VLAN_N_VID), devm_kmalloc_array(params->dev, BITS_TO_LONGS(VLAN_N_VID),
......
...@@ -490,9 +490,9 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs, ...@@ -490,9 +490,9 @@ int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs,
ale_params.ale_ports = CPSW_ALE_PORTS_NUM; ale_params.ale_ports = CPSW_ALE_PORTS_NUM;
cpsw->ale = cpsw_ale_create(&ale_params); cpsw->ale = cpsw_ale_create(&ale_params);
if (!cpsw->ale) { if (IS_ERR(cpsw->ale)) {
dev_err(dev, "error initializing ale engine\n"); dev_err(dev, "error initializing ale engine\n");
return -ENODEV; return PTR_ERR(cpsw->ale);
} }
dma_params.dev = dev; dma_params.dev = dev;
......
...@@ -3704,9 +3704,9 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev, ...@@ -3704,9 +3704,9 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
ale_params.nu_switch_ale = true; ale_params.nu_switch_ale = true;
} }
gbe_dev->ale = cpsw_ale_create(&ale_params); gbe_dev->ale = cpsw_ale_create(&ale_params);
if (!gbe_dev->ale) { if (IS_ERR(gbe_dev->ale)) {
dev_err(gbe_dev->dev, "error initializing ale engine\n"); dev_err(gbe_dev->dev, "error initializing ale engine\n");
ret = -ENODEV; ret = PTR_ERR(gbe_dev->ale);
goto free_sec_ports; goto free_sec_ports;
} else { } else {
dev_dbg(gbe_dev->dev, "Created a gbe ale engine\n"); dev_dbg(gbe_dev->dev, "Created a gbe ale engine\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment