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

Commit b2c0805f authored by Steven Rostedt's avatar Steven Rostedt Committed by David S. Miller
Browse files

sparc: make proces_ver_nack a bit more readable



Impact: clean up

The code in process_ver_nack is a little obfuscated. This change
makes it a bit more readable by humans. It removes the complex
if statement and replaces it with a cleaner flow of control.

Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 238c6d54
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -625,22 +625,23 @@ static int process_ver_ack(struct ldc_channel *lp, struct ldc_version *vp)
static int process_ver_nack(struct ldc_channel *lp, struct ldc_version *vp)
{
	struct ldc_version *vap;

	if ((vp->major == 0 && vp->minor == 0) ||
	    !(vap = find_by_major(vp->major))) {
		return ldc_abort(lp);
	} else {
	struct ldc_packet *p;
	unsigned long new_tail;

	if (vp->major == 0 && vp->minor == 0)
		return ldc_abort(lp);

	vap = find_by_major(vp->major);
	if (!vap)
		return ldc_abort(lp);

	p = handshake_compose_ctrl(lp, LDC_INFO, LDC_VERS,
					   vap, sizeof(*vap),
					   &new_tail);
		if (p)
			return send_tx_packet(lp, p, new_tail);
		else
	if (!p)
		return ldc_abort(lp);
	}

	return send_tx_packet(lp, p, new_tail);
}

static int process_version(struct ldc_channel *lp,