OSDN Git Service

virtio: use WARN_ON() to warning illegal status value
authorJason Wang <jasowang@redhat.com>
Fri, 27 May 2022 06:01:20 +0000 (14:01 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 31 May 2022 16:45:10 +0000 (12:45 -0400)
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 <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Halil Pasic <pasic@linux.ibm.com>
Cc: Cornelia Huck <cohuck@redhat.com>
Cc: Vineeth Vijayan <vneethv@linux.ibm.com>
Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220527060120.20964-10-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
include/linux/virtio_config.h

index d4edfd7..9a36051 100644 (file)
@@ -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()