Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3161972imm; Mon, 13 Aug 2018 07:04:19 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyTADemRaWV9e45B89DNfALl+R+504Pdl8N7/25ximagZozGUPIyG1lGj1kAY5j74Rg/Ue8 X-Received: by 2002:a63:ec43:: with SMTP id r3-v6mr16728827pgj.295.1534169059568; Mon, 13 Aug 2018 07:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534169059; cv=none; d=google.com; s=arc-20160816; b=WySey//7A8oEpvPz4NnAnH0E5bhZsLafaSdsLsTaSNJMuvxsTFbmqgSyK/4d7V8Sjo zjbvlNounJSIFTPm8qEYe7bDd3OKze7VYHdq2139/CBQq6gKZDjKyPX3Tkm8Na9wnGO8 xriUGtEG6Cv56O0n3hWD86cJI4OQmHFjSrSUp4HCi9DYK0ZKJRS4BARqZHs6fZ24ekXD 3wNQ0LWOTD5N6jVBKxh7kv79McQjEdom47c/XlMxua3FcA80oWX3/AKp4JdupBPddojb +1zHIhUo9tyTRxqcE7iOhIOotAm88wbRyo3+3CG5aEUjWIGgpYYHqyR9zp28xjPOLFmW 5ixg== 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=rEhqyFFkjDh3/PTR48ea3nMFFSkjKbTELfjTAbleNQDGygBdS/7lz4Ev0rxQgz0hSx OhapnS1RvEHSsHwuBb/XCIrfPvP4Vg8oGo+Q7KvPVRv10W8V5zoasMgKZQhmHFwgoF32 IPhhi6pX5oo+t4oJzCTdAAczh1s7fu5fyztirRJyBwmkxe5hGmnIu0c/TDHlsRm/a5no EhvXsiqfgpGGY/dLXZ4NRFt1JZj6DO2WFRsnziB7rFWV0HJqiN3U1HgWebj8HhMBXhty 2UmpsnRepxs7SbicHFtluVRtHNtyPumrjjSgs2KxgrmWwqKplP/u5rjqWSTo59LZVIma id/A== 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 o14-v6si14429065pll.185.2018.08.13.07.04.03; Mon, 13 Aug 2018 07:04:19 -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 S1729852AbeHMQnn (ORCPT + 99 others); Mon, 13 Aug 2018 12:43:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:60850 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729286AbeHMQnn (ORCPT ); Mon, 13 Aug 2018 12:43:43 -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 536D8AFDF; Mon, 13 Aug 2018 14:01:17 +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 v3 3/5] xen/blkfront: reorder tests in xlblk_init() Date: Mon, 13 Aug 2018 16:01:12 +0200 Message-Id: <20180813140114.20126-4-jgross@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180813140114.20126-1-jgross@suse.com> References: <20180813140114.20126-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