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

Commit 0e35fd5e authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller
Browse files

tipc: Eliminate improper use of TIPC_OK error code



This patch corrects many places where TIPC routines indicated
successful completion by returning TIPC_OK instead of 0.
(The TIPC_OK symbol has the value 0, but it should only be used
in contexts that deal with the error code field of a TIPC
message header.)

Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2da59918
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -611,7 +611,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,
		bcbearer->bpairs[bp_index].secondary = p;
update:
		if (bcbearer->remains_new.count == 0)
			return TIPC_OK;
			return 0;

		bcbearer->remains = bcbearer->remains_new;
	}
@@ -620,7 +620,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf,

	bcbearer->bearer.publ.blocked = 1;
	bcl->stats.bearer_congs++;
	return ~TIPC_OK;
	return 1;
}

/**
@@ -756,7 +756,7 @@ int tipc_bclink_reset_stats(void)
	spin_lock_bh(&bc_lock);
	memset(&bcl->stats, 0, sizeof(bcl->stats));
	spin_unlock_bh(&bc_lock);
	return TIPC_OK;
	return 0;
}

int tipc_bclink_set_queue_limits(u32 limit)
@@ -769,7 +769,7 @@ int tipc_bclink_set_queue_limits(u32 limit)
	spin_lock_bh(&bc_lock);
	tipc_link_set_queue_limits(bcl, limit);
	spin_unlock_bh(&bc_lock);
	return TIPC_OK;
	return 0;
}

int tipc_bclink_init(void)
@@ -810,7 +810,7 @@ int tipc_bclink_init(void)
		tipc_printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE);
	}

	return TIPC_OK;
	return 0;
}

void tipc_bclink_stop(void)
+4 −4
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ void tipc_bearer_remove_dest(struct bearer *b_ptr, u32 dest)
 */
static int bearer_push(struct bearer *b_ptr)
{
	u32 res = TIPC_OK;
	u32 res = 0;
	struct link *ln, *tln;

	if (b_ptr->publ.blocked)
@@ -607,7 +607,7 @@ int tipc_block_bearer(const char *name)
	}
	spin_unlock_bh(&b_ptr->publ.lock);
	read_unlock_bh(&tipc_net_lock);
	return TIPC_OK;
	return 0;
}

/**
@@ -645,7 +645,7 @@ static int bearer_disable(const char *name)
	}
	spin_unlock_bh(&b_ptr->publ.lock);
	memset(b_ptr, 0, sizeof(struct bearer));
	return TIPC_OK;
	return 0;
}

int tipc_disable_bearer(const char *name)
@@ -668,7 +668,7 @@ int tipc_bearer_init(void)
	tipc_bearers = kcalloc(MAX_BEARERS, sizeof(struct bearer), GFP_ATOMIC);
	media_list = kcalloc(MAX_MEDIA, sizeof(struct media), GFP_ATOMIC);
	if (tipc_bearers && media_list) {
		res = TIPC_OK;
		res = 0;
	} else {
		kfree(tipc_bearers);
		kfree(media_list);
+1 −1
Original line number Diff line number Diff line
@@ -571,6 +571,6 @@ void tipc_cltr_broadcast(struct sk_buff *buf)
int tipc_cltr_init(void)
{
	tipc_highest_allowed_slave = LOWEST_SLAVE + tipc_max_slaves;
	return tipc_cltr_create(tipc_own_addr) ? TIPC_OK : -ENOMEM;
	return tipc_cltr_create(tipc_own_addr) ? 0 : -ENOMEM;
}
+3 −3
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
				 dev->dev_addr, clone->len);
		dev_queue_xmit(clone);
	}
	return TIPC_OK;
	return 0;
}

/**
@@ -113,12 +113,12 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev,
			if (likely(buf->len == size)) {
				buf->next = NULL;
				tipc_recv_msg(buf, eb_ptr->bearer);
				return TIPC_OK;
				return 0;
			}
		}
	}
	kfree_skb(buf);
	return TIPC_OK;
	return 0;
}

/**
+9 −9
Original line number Diff line number Diff line
@@ -1561,7 +1561,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
			l_ptr->retransm_queue_head = mod(++r_q_head);
			l_ptr->retransm_queue_size = --r_q_size;
			l_ptr->stats.retransmitted++;
			return TIPC_OK;
			return 0;
		} else {
			l_ptr->stats.bearer_congs++;
			msg_dbg(buf_msg(buf), "|>DEF-RETR>");
@@ -1580,7 +1580,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
			l_ptr->unacked_window = 0;
			buf_discard(buf);
			l_ptr->proto_msg_queue = NULL;
			return TIPC_OK;
			return 0;
		} else {
			msg_dbg(buf_msg(buf), "|>DEF-PROT>");
			l_ptr->stats.bearer_congs++;
@@ -1604,7 +1604,7 @@ u32 tipc_link_push_packet(struct link *l_ptr)
					msg_set_type(msg, CLOSED_MSG);
				msg_dbg(msg, ">PUSH-DATA>");
				l_ptr->next_out = buf->next;
				return TIPC_OK;
				return 0;
			} else {
				msg_dbg(msg, "|PUSH-DATA|");
				l_ptr->stats.bearer_congs++;
@@ -1628,8 +1628,8 @@ void tipc_link_push_queue(struct link *l_ptr)

	do {
		res = tipc_link_push_packet(l_ptr);
	}
	while (res == TIPC_OK);
	} while (!res);

	if (res == PUSH_FAILED)
		tipc_bearer_schedule(l_ptr->b_ptr, l_ptr);
}
@@ -2998,7 +2998,7 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
			link_set_supervision_props(l_ptr, new_value);
			tipc_link_send_proto_msg(l_ptr, STATE_MSG,
						 0, 0, new_value, 0, 0);
			res = TIPC_OK;
			res = 0;
		}
		break;
	case TIPC_CMD_SET_LINK_PRI:
@@ -3007,14 +3007,14 @@ struct sk_buff *tipc_link_cmd_config(const void *req_tlv_area, int req_tlv_space
			l_ptr->priority = new_value;
			tipc_link_send_proto_msg(l_ptr, STATE_MSG,
						 0, 0, 0, new_value, 0);
			res = TIPC_OK;
			res = 0;
		}
		break;
	case TIPC_CMD_SET_LINK_WINDOW:
		if ((new_value >= TIPC_MIN_LINK_WIN) &&
		    (new_value <= TIPC_MAX_LINK_WIN)) {
			tipc_link_set_queue_limits(l_ptr, new_value);
			res = TIPC_OK;
			res = 0;
		}
		break;
	}
@@ -3230,7 +3230,7 @@ int link_control(const char *name, u32 op, u32 val)
			if (op == TIPC_CMD_UNBLOCK_LINK) {
				l_ptr->blocked = 0;
			}
			res = TIPC_OK;
			res = 0;
		}
		tipc_node_unlock(node);
	}
Loading