Skip to content

Commit 4bcddba

Browse files
jgross1konradwilk
authored andcommitted
xen/blkfront: reorder tests in xlblk_init()
In case we don't want pv block devices we should not test parameters for sanity and eventually print out error messages. So test precluding conditions before checking parameters. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
1 parent a46b536 commit 4bcddba

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/block/xen-blkfront.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,15 @@ static int __init xlblk_init(void)
27082708
if (!xen_domain())
27092709
return -ENODEV;
27102710

2711+
if (!xen_has_pv_disk_devices())
2712+
return -ENODEV;
2713+
2714+
if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
2715+
pr_warn("xen_blk: can't get major %d with name %s\n",
2716+
XENVBD_MAJOR, DEV_NAME);
2717+
return -ENODEV;
2718+
}
2719+
27112720
if (xen_blkif_max_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST)
27122721
xen_blkif_max_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST;
27132722

@@ -2723,15 +2732,6 @@ static int __init xlblk_init(void)
27232732
xen_blkif_max_queues = nr_cpus;
27242733
}
27252734

2726-
if (!xen_has_pv_disk_devices())
2727-
return -ENODEV;
2728-
2729-
if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) {
2730-
printk(KERN_WARNING "xen_blk: can't get major %d with name %s\n",
2731-
XENVBD_MAJOR, DEV_NAME);
2732-
return -ENODEV;
2733-
}
2734-
27352735
INIT_DELAYED_WORK(&blkfront_work, blkfront_delay_work);
27362736

27372737
ret = xenbus_register_frontend(&blkfront_driver);

0 commit comments

Comments
 (0)