Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3420290imm; Mon, 6 Aug 2018 04:36:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc8RAMY+lnuto3AA85GZPsDwOpdNtwoZ4o4DHb4vEEsSplVLq8ybI+eUe16kOGR+G+JqWqC X-Received: by 2002:a63:7412:: with SMTP id p18-v6mr13620542pgc.395.1533555390538; Mon, 06 Aug 2018 04:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533555390; cv=none; d=google.com; s=arc-20160816; b=j2dzypODYKwsSb2nkLS1B96y2iAd2Vdw4aiWANppwvyGH4Nj6l7UYU7Cmutc0CrDUe KjnLaX2gmq0EO6oHJ7CwCxJLztzOs9Ig94b6ExmO7jZfgs00Znl/oLSmoFSliKqITov3 3NnsGJRs1AIG/SdGlsnnn2BGLVdDbZ+4RYpd5vyiDXZnCzY7F2jhcoZjLFenfMnZqnnI TfODuT9WEJ0NWD6jAoyYyX7L6kEA1sptGc0spWrV5Kthgn7rGMOep353OKTWz4uTWEUK mS6oyQ8RQJswZg4BJupZkcNRFxNgAUovAB/zw6Oh9e1gB8VAEWql9NMggdo5VQAz5GKz f2LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=GV7w49a8wRnXoWwqFzEwJ0dp3qJbBfY5MoFNdW5v2KM=; b=SpQr3hngjwLefPaOyNxL/qwgKLz4p03eLB+c84ndmekfyyin7Zy/pUufsxfdcxfFkZ AgTbhVETDohBJNNV6sjJegyS+P5rCybTHILPw3SWrRrhS2YD4/edFzXUJL9kF2EN6OwM zxvSuK83i5JO7USI/dB7wt4QFfUkbyrI8W5QU+JZL+Xg+FIE6EcF1CN4wqn3XLVI837e 1nxiSng/g83OTovV2cElvQVp0IKlzAMXuG3ing7qIbhFybA2UbkdIYTEKe1IdBe9aSjB LszmDgT8wpizfsFC6FQ+3nE22CVjmCV8PCGC/I/d4/9ZIk242Znul0TP0mp305d7pKxy 4q2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5-v6si9997615pgq.316.2018.08.06.04.36.15; Mon, 06 Aug 2018 04:36:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730229AbeHFNm7 (ORCPT + 99 others); Mon, 6 Aug 2018 09:42:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:33662 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727940AbeHFNm7 (ORCPT ); Mon, 6 Aug 2018 09:42:59 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D4AFAAD6A; Mon, 6 Aug 2018 11:34:18 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-block@vger.kernel.org Cc: konrad.wilk@oracle.com, roger.pau@citrix.com, axboe@kernel.dk, boris.ostrovsky@oracle.com, Juergen Gross Subject: [PATCH 3/4] xen/blkfront: reorder tests in xlblk_init() Date: Mon, 6 Aug 2018 13:34:02 +0200 Message-Id: <20180806113403.24728-5-jgross@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180806113403.24728-1-jgross@suse.com> References: <20180806113403.24728-1-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/block/xen-blkfront.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 19feb8835fc4..f72d96384326 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -2718,6 +2718,15 @@ static int __init xlblk_init(void) if (!xen_domain()) return -ENODEV; + if (!xen_has_pv_disk_devices()) + return -ENODEV; + + if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) { + pr_warn("xen_blk: can't get major %d with name %s\n", + XENVBD_MAJOR, DEV_NAME); + return -ENODEV; + } + if (xen_blkif_max_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST) xen_blkif_max_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST; @@ -2733,15 +2742,6 @@ static int __init xlblk_init(void) xen_blkif_max_queues = nr_cpus; } - if (!xen_has_pv_disk_devices()) - return -ENODEV; - - if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) { - printk(KERN_WARNING "xen_blk: can't get major %d with name %s\n", - XENVBD_MAJOR, DEV_NAME); - return -ENODEV; - } - INIT_DELAYED_WORK(&blkfront_work, blkfront_delay_work); ret = xenbus_register_frontend(&blkfront_driver); -- 2.13.7