Skip to content

Commit

Permalink
sparc: make proces_ver_nack a bit more readable
Browse files Browse the repository at this point in the history
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: Steven Rostedt <srostedt@redhat.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Steven Rostedt authored and David S. Miller committed Jan 6, 2009
1 parent 238c6d5 commit b2c0805
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions arch/sparc/kernel/ldc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
struct ldc_packet *p;
unsigned long new_tail;

if ((vp->major == 0 && vp->minor == 0) ||
!(vap = find_by_major(vp->major))) {
if (vp->major == 0 && vp->minor == 0)
return ldc_abort(lp);

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

p = handshake_compose_ctrl(lp, LDC_INFO, LDC_VERS,
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
return ldc_abort(lp);
}
if (!p)
return ldc_abort(lp);

return send_tx_packet(lp, p, new_tail);
}

static int process_version(struct ldc_channel *lp,
Expand Down

0 comments on commit b2c0805

Please sign in to comment.