diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-08-13 22:58:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-08-14 20:00:56 -0400 |
commit | 137bc99ff30aa1d9bf556ee9c8ba788a8ec0f595 (patch) | |
tree | 508a75b1e786e074c98d6c80eabc68e7e3f656bd /drivers/net | |
parent | f37c54b6a6c56489221d42ff27305e4f8098e34b (diff) |
drivers/net/ethernet/freescale/fs_enet: fix error return code
Convert a 0 error return code to a negative one, as returned elsewhere in the
function.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@
(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
... when != ret = e4
* return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c index 0f2d1a710909..151453309401 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | |||
@@ -174,8 +174,10 @@ static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) | |||
174 | 174 | ||
175 | new_bus->phy_mask = ~0; | 175 | new_bus->phy_mask = ~0; |
176 | new_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); | 176 | new_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); |
177 | if (!new_bus->irq) | 177 | if (!new_bus->irq) { |
178 | ret = -ENOMEM; | ||
178 | goto out_unmap_regs; | 179 | goto out_unmap_regs; |
180 | } | ||
179 | 181 | ||
180 | new_bus->parent = &ofdev->dev; | 182 | new_bus->parent = &ofdev->dev; |
181 | dev_set_drvdata(&ofdev->dev, new_bus); | 183 | dev_set_drvdata(&ofdev->dev, new_bus); |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c index 55bb867258e6..cdf702a59485 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c | |||
@@ -137,8 +137,10 @@ static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) | |||
137 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); | 137 | snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start); |
138 | 138 | ||
139 | fec->fecp = ioremap(res.start, resource_size(&res)); | 139 | fec->fecp = ioremap(res.start, resource_size(&res)); |
140 | if (!fec->fecp) | 140 | if (!fec->fecp) { |
141 | ret = -ENOMEM; | ||
141 | goto out_fec; | 142 | goto out_fec; |
143 | } | ||
142 | 144 | ||
143 | if (get_bus_freq) { | 145 | if (get_bus_freq) { |
144 | clock = get_bus_freq(ofdev->dev.of_node); | 146 | clock = get_bus_freq(ofdev->dev.of_node); |
@@ -172,8 +174,10 @@ static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev) | |||
172 | 174 | ||
173 | new_bus->phy_mask = ~0; | 175 | new_bus->phy_mask = ~0; |
174 | new_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); | 176 | new_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL); |
175 | if (!new_bus->irq) | 177 | if (!new_bus->irq) { |
178 | ret = -ENOMEM; | ||
176 | goto out_unmap_regs; | 179 | goto out_unmap_regs; |
180 | } | ||
177 | 181 | ||
178 | new_bus->parent = &ofdev->dev; | 182 | new_bus->parent = &ofdev->dev; |
179 | dev_set_drvdata(&ofdev->dev, new_bus); | 183 | dev_set_drvdata(&ofdev->dev, new_bus); |