Reported-by: David Miller davem@davemloft.net Signed-off-by: Antonio Quartulli ordex@autistici.org ---
This patch is for *next*. This patch fixes a problem pointed out by David S. Miller.
Actually the idea is to use real error codes instead of meaningless -1, even if this codes are only used internally to the batman-adv code. IMHO it is a good idea. Most of the times we convert -1 to real error codes later, but I think it is better to user real code directly. This patch will be squashed with a patch which is going to be sent in the next pull request. Another patch which fix the other error codes should follow.
Cheers,
bat_iv_ogm.c | 2 +- hard-interface.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c index ab2085c..2a1845e 100644 --- a/bat_iv_ogm.c +++ b/bat_iv_ogm.c @@ -59,7 +59,7 @@ static int bat_iv_ogm_iface_enable(struct hard_iface *hard_iface) { struct batman_ogm_packet *batman_ogm_packet; uint32_t random_seqno; - int res = -1; + int res = -ENOMEM;
/* randomize initial seqno to avoid collision */ get_random_bytes(&random_seqno, sizeof(random_seqno)); diff --git a/hard-interface.c b/hard-interface.c index e647a43..843caa7 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -309,10 +309,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface, bat_priv = netdev_priv(hard_iface->soft_iface);
ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface); - if (ret < 0) { - ret = -ENOMEM; + if (ret < 0) goto err_dev; - }
hard_iface->if_num = bat_priv->num_ifaces; bat_priv->num_ifaces++;