Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5346c35e authored by Sven Eckelmann's avatar Sven Eckelmann Committed by Antonio Quartulli
Browse files

batman-adv: Return error codes instead of -1 on failures

parent e0f5211f
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -195,13 +195,13 @@ static int debug_log_setup(struct bat_priv *bat_priv)

	d = debugfs_create_file("log", S_IFREG | S_IRUSR,
				bat_priv->debug_dir, bat_priv, &log_fops);
	if (d)
	if (!d)
		goto err;

	return 0;

err:
	return 1;
	return -ENOMEM;
}

static void debug_log_cleanup(struct bat_priv *bat_priv)
@@ -348,8 +348,11 @@ int debugfs_add_meshif(struct net_device *dev)
	if (!bat_priv->debug_dir)
		goto out;

	bat_socket_setup(bat_priv);
	debug_log_setup(bat_priv);
	if (bat_socket_setup(bat_priv) < 0)
		goto rem_attr;

	if (debug_log_setup(bat_priv) < 0)
		goto rem_attr;

	for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) {
		file = debugfs_create_file(((*bat_debug)->attr).name,
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,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));
+1 −1
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ void sysfs_del_hardif(struct kobject **hardif_obj)
int throw_uevent(struct bat_priv *bat_priv, enum uev_type type,
		 enum uev_action action, const char *data)
{
	int ret = -1;
	int ret = -ENOMEM;
	struct hard_iface *primary_if = NULL;
	struct kobject *bat_kobj;
	char *uevent_env[4] = { NULL, NULL, NULL, NULL };
+3 −3
Original line number Diff line number Diff line
@@ -1164,13 +1164,13 @@ int bla_init(struct bat_priv *bat_priv)
	bat_priv->bcast_duplist_curr = 0;

	if (bat_priv->claim_hash)
		return 1;
		return 0;

	bat_priv->claim_hash = hash_new(128);
	bat_priv->backbone_hash = hash_new(32);

	if (!bat_priv->claim_hash || !bat_priv->backbone_hash)
		return -1;
		return -ENOMEM;

	batadv_hash_set_lock_class(bat_priv->claim_hash,
				   &claim_hash_lock_class_key);
@@ -1180,7 +1180,7 @@ int bla_init(struct bat_priv *bat_priv)
	bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n");

	bla_start_timer(bat_priv);
	return 1;
	return 0;
}

/**
+1 −3
Original line number Diff line number Diff line
@@ -306,10 +306,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++;
Loading