Skip to content

Commit

Permalink
xen/hvc: Collapse error logic.
Browse files Browse the repository at this point in the history
All of the error paths are doing the same logic. In which
case we might as well collapse them in one path.

CC: stable@kernel.org
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Konrad Rzeszutek Wilk committed May 24, 2012
1 parent 68c2c39 commit 2e5ad6b
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions drivers/tty/hvc/hvc_xen.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,29 +216,26 @@ static int xen_hvm_console_init(void)
return 0;

r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
if (r < 0) {
kfree(info);
return -ENODEV;
}
if (r < 0)
goto err;
info->evtchn = v;
hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
if (r < 0) {
kfree(info);
return -ENODEV;
}
if (r < 0)
goto err;
mfn = v;
info->intf = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE);
if (info->intf == NULL) {
kfree(info);
return -ENODEV;
}
if (info->intf == NULL)
goto err;
info->vtermno = HVC_COOKIE;

spin_lock(&xencons_lock);
list_add_tail(&info->list, &xenconsoles);
spin_unlock(&xencons_lock);

return 0;
err:
kfree(info);
return -ENODEV;
}

static int xen_pv_console_init(void)
Expand Down

0 comments on commit 2e5ad6b

Please sign in to comment.