Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2634417imm; Fri, 20 Jul 2018 02:03:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfG006oH/U8VhthR/oBx2mVY83qtlS1wjSjkhsFiIh21nfODf+wZK8YAbQ9znSf+le4E3uU X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr1327156pfn.77.1532077390539; Fri, 20 Jul 2018 02:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532077390; cv=none; d=google.com; s=arc-20160816; b=ECjhfLoRXHcp0xlPUmWal/02al6GgqGi531ROJVdopqDr8xXxXA1lqXzWU+qXvKbK0 aANydC4CuMlTpfiiP/MuUigkIDBHd8WJjAHtjyq76MLnErEwDSrFqN2G6nE/M9/2sHiG vgf/ZzdBzCbXs5HTvnVmxTPhY3ZuwBwjg+Rpe/CJgn+CVjMfFF2vJ9cyFn8z5t/vl73n g8Jg653k1WrfgXnkS/SvEYnfRJsEWT9uWqHRiIaToKIYdlEoBtqUwQ+WG4fUo8oAXFoP 4klxQEatL1ivC+YZOEoSZjjPVikCmZ0c004I8g8yQgLCy/PHwf/xIM9lo3XxrHcCsBv0 ePyg== 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=kOLno4LKhk3T/XPSnPPliijl4UUViLWBO74lue5FG5o=; b=QN9G3nrWgO9oL/rF+DZ6MljlzJQymdFg+VJt2QWXinhItQkKJkXdvrBOe36/9UBadR 0vjUvemXa9/FTFy3+n9GNpNqAySeahOP5JCCm+Jnddr89cKo6Tma5qybXX7sk8NK/mlv qduxdBRSoqLog8asJmpy2eYsxEa/4phNxOm4S4cP/tPrRH7lQQl6b07PbiaXJq3h4WeM 9NevrMi5e953EqSkGHpA4L2ytXOwgrvgqVK8AKvoqwGWTpA4FxBRDmP5FkP8w311KuYH YqCGuBzxSKoRLK9fh4eHYfk2FaEdgAH4j2R4qvuaZJv6UYKDPaxybEbNc8yKL7DA/41r 5WUA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d65-v6si1354955pgc.524.2018.07.20.02.02.50; Fri, 20 Jul 2018 02:03:10 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728333AbeGTJsU (ORCPT + 99 others); Fri, 20 Jul 2018 05:48:20 -0400 Received: from mga12.intel.com ([192.55.52.136]:18470 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727167AbeGTJrz (ORCPT ); Fri, 20 Jul 2018 05:47:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2018 02:00:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,378,1526367600"; d="scan'208";a="66141353" Received: from devel-ww.sh.intel.com ([10.239.48.110]) by FMSMGA003.fm.intel.com with ESMTP; 20 Jul 2018 02:00:22 -0700 From: Wei Wang To: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, mst@redhat.com, mhocko@kernel.org, akpm@linux-foundation.org, torvalds@linux-foundation.org Cc: pbonzini@redhat.com, wei.w.wang@intel.com, liliang.opensource@gmail.com, yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com, riel@redhat.com, peterx@redhat.com Subject: [PATCH v36 1/5] virtio-balloon: remove BUG() in init_vqs Date: Fri, 20 Jul 2018 16:33:01 +0800 Message-Id: <1532075585-39067-2-git-send-email-wei.w.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532075585-39067-1-git-send-email-wei.w.wang@intel.com> References: <1532075585-39067-1-git-send-email-wei.w.wang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.7.4