Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4760241iob; Mon, 9 May 2022 00:32:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8Gr21TJ/BlebkmOBmoSb7EQviGX3axnskMqKJi4ao6iqi5fgzNHuLtw1eolAamSzbPEvy X-Received: by 2002:a17:902:e74d:b0:15e:94f7:611e with SMTP id p13-20020a170902e74d00b0015e94f7611emr15187586plf.37.1652081531986; Mon, 09 May 2022 00:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652081531; cv=none; d=google.com; s=arc-20160816; b=N0UiDNhZFXTFErJ0BrFalGPzh6qfwdaikCZh3yP1eDRtnKeK4SVL4X9qxWNdey4xWQ ay109wiJzpmDro+LaNPuE8DhYm/+ItebdL/druDiGX3nTIb0g2WwbnfHLuGYd8AVUskI XV9FXiKxrdORxCkIr7ntvgaZL95B4DCPf3a7fxZT9icOra5wzfKQxQ1jYLDjCIwqLLkv 9GAD330m040ICFte4FIAEmyyaY6OHJFHh2xHPeJKBkRi1VNYgf11QXLM8G4ueVHAdn+j QtWUBwOln7oCHUmNmLGhYODCA5F7Q7vMCtSjZM0EvyBbRoewNh/bUaCwydjADJaBomLq cfHw== 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=/OrDhR3xrTuYjXDb+dW3SHAfSccXogpE1Lj4O6Dtyns=; b=xZ0j4+kHe6I49xjkrtnQbhKxHbGoRkeZX1JoNeDsB86jp1aCuv10woaVb+D6LtqeoJ Mhcs0WWEjRcTLLfp7kjU+d1tH5WWJRQbiPNsWYHfoggBsEiOLKeQGL7uwvnBONl8OtdM RwekRNLitbqdYZRCwAzZUWd9eOFjHziXXEiSPX+/AIcMpzxuwoHRfZJd4rDtB8QTrUHF mWiHYj+HoAao9E8TZDq9DOHeet4rGN2pEKbOEGaVCwBySwV65lElneRd5DUR6zjOc4n6 uwziWLQJZU4k4J9VBBm0mczc+qIy28vuFIMAqaXDSEDC5u/vYTRtWYlaVlzuKrQWOqkl R2jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g77F7I9f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 13-20020a63124d000000b003a282486e3csi13254884pgs.12.2022.05.09.00.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 00:32:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g77F7I9f; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 585C71B3B93; Mon, 9 May 2022 00:29:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446003AbiEGHY4 (ORCPT + 99 others); Sat, 7 May 2022 03:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1446027AbiEGHYv (ORCPT ); Sat, 7 May 2022 03:24:51 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3FFC66160E for ; Sat, 7 May 2022 00:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651908064; 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=/OrDhR3xrTuYjXDb+dW3SHAfSccXogpE1Lj4O6Dtyns=; b=g77F7I9fzveDaLuFWXFZpqRO7VeEzjMJWcK/ykoPWyz6VPRriz5qk+l2yUdzQD8qvQ1yAt GWqDNyFu06tNw3sQtt4c3tHJNXbjMn7MeR/tyZ9X3lq7MAl9aErxDsJOFuOtu0OEzYWVzh bx5tLUXO1jJgtoLemkr0i7wxz9rg8YU= 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-473-rT-x5dtrOwyDQc22EMAw_g-1; Sat, 07 May 2022 03:21:03 -0400 X-MC-Unique: rT-x5dtrOwyDQc22EMAw_g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 77C283810D3F; Sat, 7 May 2022 07:21:02 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-216.pek2.redhat.com [10.72.13.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id E954C40D2971; Sat, 7 May 2022 07:20:56 +0000 (UTC) From: Jason Wang To: jasowang@redhat.com, mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, peterz@infradead.org, paulmck@kernel.org, maz@kernel.org, pasic@linux.ibm.com, cohuck@redhat.com, eperezma@redhat.com, lulu@redhat.com, sgarzare@redhat.com, xuanzhuo@linux.alibaba.com Subject: [PATCH V4 9/9] virtio: use WARN_ON() to warning illegal status value Date: Sat, 7 May 2022 15:19:54 +0800 Message-Id: <20220507071954.14455-10-jasowang@redhat.com> In-Reply-To: <20220507071954.14455-1-jasowang@redhat.com> References: <20220507071954.14455-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 23f1694cdbd5..5d539f39f7ee 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -255,7 +255,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