From patchwork Fri Jul 27 09:24:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Wei W" X-Patchwork-Id: 10546815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DECA114E0 for ; Fri, 27 Jul 2018 09:52:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE8E82863F for ; Fri, 27 Jul 2018 09:52:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C16412B463; Fri, 27 Jul 2018 09:52:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F12D2863F for ; Fri, 27 Jul 2018 09:52:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF4D06B0005; Fri, 27 Jul 2018 05:52:49 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C2F106B0007; Fri, 27 Jul 2018 05:52:49 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAC176B0008; Fri, 27 Jul 2018 05:52:49 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by kanga.kvack.org (Postfix) with ESMTP id 5BEEC6B0005 for ; Fri, 27 Jul 2018 05:52:49 -0400 (EDT) Received: by mail-pg1-f199.google.com with SMTP id h5-v6so2684413pgs.13 for ; Fri, 27 Jul 2018 02:52:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=kOLno4LKhk3T/XPSnPPliijl4UUViLWBO74lue5FG5o=; b=GwLSTrPLz8JqnL6zvgvayJQRYT5GJT/K7+BQjuYBoy7uDT8w0m1IuTS2tV6NquR1b/ sNt+RbLnBGWbLjoK9LvDqDfyVAm6CdCeXfFwAVgSbkM4LX89CyMlaE8jxKc6VElgTdT/ ib/vGg13ZaT0U7NCx87a70bM899y1Nm7VU28FIiaSDxFCAMX0/EkWW8HliC0nCrjxfvT x5UM2A7szRRhpN4gReujFfOlJVx5zQU28g/D5O73FNhHnCqMTGvUuxdgehGMrmr7zLBD YCwdOJohzaPtf4RfoKU5MW4LL7UzR4p04XP1ZKmKh0PfmrowYSvjwu6d/v7enjXS7tAL /Zzg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=wei.w.wang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AOUpUlF3B2nv+6B2ZPSHtqWmB9NawiCAUEpQ4N6kMCbTVAmRXvDbCLkg guJf0kj8LP2rRkk5oGOEJE+Gz3nZW/VvBW9k1/SUwhmI4fciTP60AqwjP0qd+CK7gPBWqmNxw0t GQFjeh5uV7V9xXqXV6BffiEZI44Euix7LXn2ECE4WBT1kaiP8EG0BBQRDchqIqCNTVw== X-Received: by 2002:a62:67c2:: with SMTP id t63-v6mr5993694pfj.204.1532685169081; Fri, 27 Jul 2018 02:52:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd9wbH3CVPmZMADCNIsYlPLJtjBP6A8tmPheK+9PUGJTC4my011wQD6QETEUnbsIl3tZs/S X-Received: by 2002:a62:67c2:: with SMTP id t63-v6mr5993659pfj.204.1532685168317; Fri, 27 Jul 2018 02:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532685168; cv=none; d=google.com; s=arc-20160816; b=QNDpP9U1LlkojTPzey6KkjWJsbcwLtBNz7xjCSRJ/HX7kCi61HEgNZMDWYwM3UdXPt 11cTIHc0OXQf4K0JL10m1l1c071sbG4asRJPx4qbH7p0mo7x3iD6FUoMY/E7MidCDr8y vJkTBkg8ZG3RI4FcvF416d2ILid3w91ITlHaLQrpTFAIsRdAYoSR7RDD5zDQkBLUvkWy TxE1W8Vn1eLnadfGuZBnbFlkv63VDGRJshSrz6e5pBBXj9DUp5UoJSMglyBjBoViEXTu AkEhj4LT8UsTJvSdI7cwxc4lpAMTBaNC4rvaRkFx/1c74HOn6cfzYNbe6YMV7K7H/YsV 3aUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kOLno4LKhk3T/XPSnPPliijl4UUViLWBO74lue5FG5o=; b=zBqCq2KC6K4kB2M6PzP4wa6VzCrZbGd5aKLlgz5yAgrBSzXbZTgZS7yVz9JpPs/HWQ au5CqWJnXMhC+qBl1ccMbrsBQzOcGH8a+DZ6Co86PQayUpSoMXKAiT2bNFJgFYNIdL2Z P0tTB6Feg9roY/QtNdc9TpSpCRAwFl5msh7BMyIQ+fMDwgr+miX8SNFVrsI17p+b4GwC aiQYI95+kAiO8+fMsgoccolF63ADn1s1jx8Mid4gXCcUGj4J1ujceBbwwOh71lIe/+yW 3RvRK4wHcllceG0TGZtfrWAjVNpN9M+x9FGQTBwn6p8inUCLPHoHvlbXHlAdV8aqMaW+ pjog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=wei.w.wang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga02.intel.com (mga02.intel.com. [134.134.136.20]) by mx.google.com with ESMTPS id a61-v6si3476062plc.80.2018.07.27.02.52.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 02:52:48 -0700 (PDT) Received-SPF: pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.20 as permitted sender) client-ip=134.134.136.20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of wei.w.wang@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=wei.w.wang@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2018 02:52:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,408,1526367600"; d="scan'208";a="78308872" Received: from devel-ww.sh.intel.com ([10.239.48.110]) by orsmga002.jf.intel.com with ESMTP; 27 Jul 2018 02:52:46 -0700 From: Wei Wang To: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, mst@redhat.com, mhocko@kernel.org, akpm@linux-foundation.org Cc: wei.w.wang@intel.com Subject: [PATCH v2 1/2] virtio-balloon: remove BUG() in init_vqs Date: Fri, 27 Jul 2018 17:24:54 +0800 Message-Id: <1532683495-31974-2-git-send-email-wei.w.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532683495-31974-1-git-send-email-wei.w.wang@intel.com> References: <1532683495-31974-1-git-send-email-wei.w.wang@intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP It's a bit overkill to use BUG when failing to add an entry to the stats_vq in init_vqs. So remove it and just return the error to the caller to bail out nicely. Signed-off-by: Wei Wang Cc: Michael S. Tsirkin --- drivers/virtio/virtio_balloon.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 6b237e3..9356a1a 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -455,9 +455,13 @@ static int init_vqs(struct virtio_balloon *vb) num_stats = update_balloon_stats(vb); sg_init_one(&sg, vb->stats, sizeof(vb->stats[0]) * num_stats); - if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL) - < 0) - BUG(); + err = virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, + GFP_KERNEL); + if (err) { + dev_warn(&vb->vdev->dev, "%s: add stat_vq failed\n", + __func__); + return err; + } virtqueue_kick(vb->stats_vq); } return 0;