Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp891039imm; Wed, 8 Aug 2018 07:28:01 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzjUKtsONid4CgwWzQ4JOjfjhseZH6th6qE2iUKyt5uye4c8W7135L+iULKI4ug/runTQkB X-Received: by 2002:a63:1b17:: with SMTP id b23-v6mr2832788pgb.275.1533738481908; Wed, 08 Aug 2018 07:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533738481; cv=none; d=google.com; s=arc-20160816; b=rhkleXkwEtmAV01MfnjiDi8J1ttQwQ3IhImi/Pf/Vt5v7Rj5CuSFvpk/gLkJ5nYv8F JE0FOJlvsusTNv1yRv0DKKpLDehOTrvNJqDe9wxHplPPVk8v8bNpnA9hQkDLRSzZeuE3 8Nc0OMiWjbmH64vUAxS/xAz7qVU2NbpkGrZMyFM46qGHDRfHamSSwO/rFTWS0CjoB3wa BC6dD0HKjdzRlW5Oft/yvmdn9UBKxIocsJ/FAGgWaxNBEjBOk5b+IS2xgJj+mnIYMruS 0QkL9X/u64xM8H7NDMqTODBUEfg0y644iRC/yL6BuO/xY3aOljnZAyhBWi4pEshA2kTR 8IHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=lLVo7iifdOs83Yrkvh1inuFEVpx5m0B0GhL8ntHpd1A=; b=xpJfI/JFfjHxySlxSuiwyeJRl01UjnfXyKHrbLe0U4VuSXxdc3t2zAbR5OTU+GxHl5 EqZ4zJoX+iqmJA3n+vjN32FqTDdWlk/3uSSWxFm6hrV3FpMGrGw9Q8ikgcc2212g7owr 1T2P5tpfX6UcKSWzw4k4lZmYeWm4V7mF83cimDHITeRhwJaXx5G/taAssZFoCEBQbLTI gmHUkL7JvZZhx7GiqoBSpJr+jHPPy6JChEQKDnHH5/vDzGKq6ExFFyn5MWkfQSk4gb9U IFrySkby3trmMtin/sq+6wRfI8wzYBonk6bX1hv938sd9uiOvaRw2p1GoNhIfhq5cUJT nPvg== 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 x66-v6si4337661pfx.129.2018.08.08.07.27.47; Wed, 08 Aug 2018 07:28:01 -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 S1727522AbeHHQpl (ORCPT + 99 others); Wed, 8 Aug 2018 12:45:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:55180 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727331AbeHHQpk (ORCPT ); Wed, 8 Aug 2018 12:45:40 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DEDFFAE9E; Wed, 8 Aug 2018 14:25:45 +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 v2 3/5] xen/blkfront: reorder tests in xlblk_init() Date: Wed, 8 Aug 2018 16:25:26 +0200 Message-Id: <20180808142528.31029-4-jgross@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180808142528.31029-1-jgross@suse.com> References: <20180808142528.31029-1-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Roger Pau Monné --- 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 7c4b1b9d3971..36e4ca41e765 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -2713,6 +2713,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; @@ -2728,15 +2737,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