Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2782843pxb; Mon, 25 Apr 2022 02:16:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPxbTi28Eev1/C2kKtVGowIuIUkx5elmQF3xRyuxMFY8waboz+xHXAKvSYZPvOT7YafVEy X-Received: by 2002:a17:906:9b8f:b0:6db:ab62:4713 with SMTP id dd15-20020a1709069b8f00b006dbab624713mr15881230ejc.738.1650878198623; Mon, 25 Apr 2022 02:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650878198; cv=none; d=google.com; s=arc-20160816; b=w3jA+6kC0NRZLdjgFhlR+atYkh8JHMhktaJQEz/xLj9R6tH/E+WytS4JwORtsJsKhW CWc5O35ptfF3pGhHUqF84u4QeqTB0xZk3Ae5wQ7wBeH3sztx/T50mDLgIMEncqEE7ftY XDdDfajWEcCENZvR6FBYMgdaCouzxSWJQGK9uHJBHEXNjCuWtEZyoxbx+tc+yqvQcUoZ cPm7fQx8C7N+p71wIeYmXfdqcrPpqRPzUdZMY2QJlw6cZ2c1Ph9qqDjV9Rx3q73nk51+ Ss9jnjAVx2EX6PXYmWibPs+dPuZebBquDD7+mWATM9PyNuRN8BwPcdL5bCKBUfopgeNn J2wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4mSFbIABjzRdSlvpdVrloyLlnqCDEpfJ/ut9z+vIsrM=; b=CTXuRp9vw0JSWrGQC0Y3D34L7R2tGnDZnptzDJi40wczUub58S1l0u6X+uxEBXDpTw ttOXb+qs+x9Wc9M12NbanN750G5fB2WOlbr40IL4yTfh4TlnjDAiAVq99L01ObrcdHXy GiHlbbt1T6SYagMtJwv0vLLoEC9MXAFIbHitvlgvNNlM8DkPz76G/ueEfmAyX8IFBJqS fdm5ZGkXqdM+noErGLqYGnW0qmTvD0gghrQsSorPKixTOmZmKu3fp88lzh2ghwqj2cFG rgFMfVj6r/vG4WihCAq0grCXFgRkFbxjpwxiXzFQNrSJypd6FfZJJza9AdqJcBnXrkNi kV4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ClB1Ddtg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170906828e00b006f3926222fesi2570688ejx.677.2022.04.25.02.16.13; Mon, 25 Apr 2022 02:16:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ClB1Ddtg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238754AbiDYCud (ORCPT + 99 others); Sun, 24 Apr 2022 22:50:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240477AbiDYCtn (ORCPT ); Sun, 24 Apr 2022 22:49:43 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BABAD68FB0 for ; Sun, 24 Apr 2022 19:46:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650854793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4mSFbIABjzRdSlvpdVrloyLlnqCDEpfJ/ut9z+vIsrM=; b=ClB1DdtgpJ84MY7qAvoD6guHVHinkXAB5tyvPuYrXzw/LPtGoYXYjHkgmoTQJNqQoedxqd N2BcvgPRlzq/9VH1ZDU5ZKT94qYQS2y2ia+fu9LmhZ4iekunoIWiJFPtd/5lBUO/fZT7sW Cx6fVHYC8MXoLexWt1cB8+1jxTWBf2E= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-4Ainub48OoWr7r0QcFBmiw-1; Sun, 24 Apr 2022 22:46:30 -0400 X-MC-Unique: 4Ainub48OoWr7r0QcFBmiw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8C0F3C14100; Mon, 25 Apr 2022 02:46:29 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-160.pek2.redhat.com [10.72.13.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 436239E6E; Mon, 25 Apr 2022 02:46:03 +0000 (UTC) From: Jason Wang To: jasowang@redhat.com, mst@redhat.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: sgarzare@redhat.com, eperezma@redhat.com, lulu@redhat.com, tglx@linutronix.de, peterz@infradead.org, paulmck@kernel.org, maz@kernel.org, pasic@linux.ibm.com, cohuck@redhat.com Subject: [PATCH V3 9/9] virtio: use WARN_ON() to warning illegal status value Date: Mon, 25 Apr 2022 10:44:18 +0800 Message-Id: <20220425024418.8415-10-jasowang@redhat.com> In-Reply-To: <20220425024418.8415-1-jasowang@redhat.com> References: <20220425024418.8415-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We used to use BUG_ON() in virtio_device_ready() to detect illegal status value, this seems sub-optimal since the value is under the control of the device. Switch to use WARN_ON() instead. Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: "Paul E. McKenney" Cc: Marc Zyngier Cc: Halil Pasic Cc: Cornelia Huck Signed-off-by: Jason Wang --- include/linux/virtio_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 3e2bc8aff51e..b0010b2ca7c2 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -254,7 +254,7 @@ void virtio_device_ready(struct virtio_device *dev) { unsigned status = dev->config->get_status(dev); - BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK); + WARN_ON(status & VIRTIO_CONFIG_S_DRIVER_OK); /* * The virtio_synchronize_cbs() makes sure vring_interrupt() -- 2.25.1