[U-Boot] [PATCH 11/12] sh_eth: Fix return value of sh_eth_initialize()

sh_eth: Return 1 from sh_eth_initialize() upon successful initialization and 0 in case of failure
Signed-off-by: Matthias Kaehlcke matthias@kaehlcke.net --- drivers/net/sh_eth.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 86cc324..330c17c 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -627,21 +627,21 @@ void sh_eth_halt(struct eth_device *dev)
int sh_eth_initialize(bd_t *bd) { - int ret = 0; + int ret = 1; struct sh_eth_dev *eth = NULL; struct eth_device *dev = NULL;
eth = (struct sh_eth_dev *)malloc(sizeof(struct sh_eth_dev)); if (!eth) { printf(SHETHER_NAME ": %s: malloc failed\n", __func__); - ret = -ENOMEM; + ret = 0; goto err; }
dev = (struct eth_device *)malloc(sizeof(struct eth_device)); if (!dev) { printf(SHETHER_NAME ": %s: malloc failed\n", __func__); - ret = -ENOMEM; + ret = 0; goto err; } memset(dev, 0, sizeof(struct eth_device));

On Sunday 24 January 2010 05:07:59 Matthias Kaehlcke wrote:
--- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c eth = (struct sh_eth_dev *)malloc(sizeof(struct sh_eth_dev)); if (!eth) { printf(SHETHER_NAME ": %s: malloc failed\n", __func__);
ret = -ENOMEM;
ret = 0;
goto err; }
dev = (struct eth_device *)malloc(sizeof(struct eth_device)); if (!dev) { printf(SHETHER_NAME ": %s: malloc failed\n", __func__);
ret = -ENOMEM;
goto err; }ret = 0;
these are error paths and thus should be -1 -mike

Hi Mike,
El Sun, Jan 24, 2010 at 05:57:52AM -0500 Mike Frysinger ha dit:
On Sunday 24 January 2010 05:07:59 Matthias Kaehlcke wrote:
--- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c eth = (struct sh_eth_dev *)malloc(sizeof(struct sh_eth_dev)); if (!eth) { printf(SHETHER_NAME ": %s: malloc failed\n", __func__);
ret = -ENOMEM;
ret = 0;
goto err; }
dev = (struct eth_device *)malloc(sizeof(struct eth_device)); if (!dev) { printf(SHETHER_NAME ": %s: malloc failed\n", __func__);
ret = -ENOMEM;
goto err; }ret = 0;
these are error paths and thus should be -1
you are right if Ben makes the change in net/eth.c he proposed
participants (2)
-
Matthias Kaehlcke
-
Mike Frysinger